Area and Circumference of a Circle
Programs with input · Beginner · about 5 min
Read the radius of a circle, a number that may have decimals. Print its area and its circumference, each rounded to 2 decimal places, as Area: 78.54 and Circumference: 31.42.
The area is pi times the radius times the radius, and the circumference is 2 times pi times the radius. Use math.pi for pi, so your answers match to the last digit.
The prompts inside input() are not checked, only what you print.
Example
You type:
5The program prints:
Area: 78.54 Circumference: 31.42
import math
r = float(input("Radius: "))
# Print the area and the circumference
The solution opens after your first Check.