Question: Write a Python program that asks a user for the diameter of a circle. Then use that value to compute the circumference of the circle
Write a Python program that asks a user for the diameter of a circle. Then use that value to compute the circumference of the circle and print the result in this format: "The circumference of a circle of diameter %D is %C." where %D is the diameter given to you and %C is the calculated circumference. The variables you use for diameter and circumference ought to be of type float. [HINT: the circumference of a circle is the diameter multiplied by pi (3.14159)]
Write a Python program that asks a user for the diameter of a circle. Then use that value to compute the radius and area of the circle and print the result in this format: "The area of a circle of radius %R is %A.", where %R is the calculated radius and %A is the calculated area. The variables you use for diameter, radius and area ought to be of type float. [HINT: the area of a circle is pi times the radius squared]
Write a Python program that asks a user for the height and width of a rectangle. Then use those values to compute the perimeter of the rectangle and print the result in this format: "The perimeter of a %H by %W rectangle is %P." where %H is the height, %W is the width and %P is the calculated perimeter. The variables you use for width, height and perimeter ought to be of type float. [HINT: the perimeter is the sum of the sides: two times height plus two times width].
Write a Python program that asks a user for the height and width of a rectangle. Then use those values to compute the area of the rectangle and print the result in this format: "The area of a %H by %W rectangle is %A." where %H is the height, %W is the width and %A is the calculated area. The variables you use for width, height and area ought to be of type float. [HINT: The area of a rectangle is height times width]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
