Search this website

Calculate area of circle in python3

No comments
Here in this code I imported math module to use PI constant ,created new function named circleArea that take one parameter that is the radius to process on it and return area 
becuase of input function take string so we need to cast the string to int using int() function
import math

def circleArea(r):

    area=(r*r)*(math.pi)

    return area

r=input("Enter Radius : ")

print("Area of Circle is:{0}".format(circleArea(int(r))))

No comments :

Post a Comment