Write a Python program which accepts the radius of a circle from the user and compute the area.
Solution 1:
1 2 3 4 5 | r = float(input("Enter radius of circle: ")) a = 3.14159 * r * r print("Area of circle =", a) |
Solution 2:
1 2 3 4 5 | from math import pi radius = float(input ("Input the radius of the circle : ")) print ("The area of the circle with radius " + str(radius) + " is: " + str(pi * radius**2)) |
Output:
