Articles

Program to calculate circumference of circle in Python

Program to calculate circumference of circle in Python


In this python programming article, we will learn to write:

  • program to calculate circumference of circle in python

Python program to calculate circumference of circle

The program to calculate circumference of circle in python is as follows:

 

# Owner : TutorialsInhand Author : Devjeet Roy
 
r = float(input('Enter radius: '))  
   
circumference = (2 * 22 * r) / 7

print("The circumference is:", round(circumference,2)) 

The output of the python program to calculate circumference of circle is as follows :

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter radius: 5
The circumference is: 31.43

Few important tips about this program:

1. As mentioned earlier, the input() function returns the user input in string format. We have used float() here to type convert the string to float type to perform mathematical computations.

2. The formula for finding the circumference of a circle is 2 x PIE x radius

 

Given below is snapshot for python program to find circumference of circle:

program to calculate circumference of circle in python

 


Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :    Published Date : Feb 01,2021  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!