To calculate area of a circle in python, you have to ask from user to enter radius of circle to calculate and print area of that circle on the output screen as shown in the program given below.
Following python program ask from user to enter radius of circle to find area of circle:
# Python Program - Calculate Area of Circle print("Enter 'x' for exit."); rad = input("Enter radius of circle: "); if rad == 'x': exit(); else: radius = float(rad); area = 3.14 * radius * radius; print("\nArea of Circle = %0.2f" %area);
Here is the sample run of the above Python program shows how to calculate area of a circle:
Above is the initial output after running the program, now you have to supply the radius of that circle whose area you want to calculate and find out. Therefore enter any radius say 7 to find out the area after pressing the enter key as shown here in below sample output:
Below is the same program on python shell:
Program Video with Compile and Run
You may also like to learn or practice the same program in other popular programming languages: