codescracker


python

Python Program to Calculate Circumference of Circle



« Previous Program Next Program »


Calculate Circumference of Circle in Python

To calculate circumference of a circle in python, you have to ask from user to enter the radius of a circle to calculate and print the circumference of that circle as shown in the program given below.

Python Programming Code to Calculate Circumference of Circle

Following python program ask from user to enter radius of a circle to find and print the circumference:

# Python Program - Calculate Circumference of Circle

print("Enter 'x' for exit.");
rad = input("Enter radius of circle: ");
if rad == 'x':
    exit();
else:
    radius = float(rad);
    circumference = 2*3.14*radius;
    print("\nCircumference of Circle =",circumference);

Here is the sample run of the above Python program shows how to calculate and print circumference of a circle:

This is the intial output asking from user to enter the radius of that circle whose circumference is going to calculate.

calculate circumference of circle python

Now type the radius of circle and press enter key to see the circumference value of the circle as shown here in below screenshot:

circumference of circle python

Here is the same program on python shell:

python calculate circumference of circle

Program Video with Compile and Run

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:


« Previous Program Next Program »








Tools
Calculator

Quick Links
Signup - Login - Give Online Test