Learn about Python Program to Find Area of Circle Using Function in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Python Program to Find Area of Circle Using Function
# python program to find area of circle using functions #import math module import math #function def area_of_circle(r): area = math.pi * r * r return area r = float(input('Enter the radius of the circle: ')) # print result print('Area of circle = %.2f ' %area_of_circle(r))
Enter the radius of the circle: 2
Area of circle = 12.57
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Python Program to Find Area of Circle using Math Module