The following example code demonstrates how to Compute the Area of a Circle Using Python.
# programmingempire.com
# Compute Area of a circle
# radius = 10
# area = 3.14 *radius * radius
# print("The area for the circle of radis", radius, "is", area)
# radius = 10
# PI=3.14
# area = PI *radius * radius
# print("The area for the circle of radis", radius, "is", area)
# radius = int(input("Enter a value for radius:"))
# PI=3.14
# area = PI *radius * radius
# print("The area for the circle of radis", radius, "is", area)
import math
radius = int(input("Enter a value for radius:"))
# PI=3.14
if radius >=0:
area = math.pi*radius * radius
print("The area for the circle of radis", radius, "is", area)
else:
print("Invalid Input")
Output
Further Reading
Examples of OpenCV Library in Python
A Brief Introduction of Pandas Library in Python