Easy Tutorial
❮ Python Lcm Python Att Dictionary Update ❯

Python Calculate the Area of a Circle

Python3 Examples

The formula for the area of a circle is:

The variable r represents the radius of the circle.

Example

# Define a method to calculate the area of a circle
def findArea(r): 
    PI = 3.142
    return PI * (r*r)

# Call the method
print("The area of the circle is %.6f" % findArea(5))

The output of the above example is:

The area of the circle is 78.550000

Python3 Examples

❮ Python Lcm Python Att Dictionary Update ❯