Python program to input radius of a circle and calculate area of a circle; Through this tutorial, i am going to show you how to write python program which accepts the radius of a circle from the user and compute or find the area of circle.
In this tutorial, i will write a python program to find area of a circle based on user input radius of circle.
Python – Input the Radius of Circle and Compute the Area
- Write a program to input radius of a circle and calculate its area in python
Program to input radius of a circle and calculate its area in python
Use the following steps and write a program to input radius of a circle and calculate its area in python:
- Import math module in python program.
- Get input number from user.
- Calculate area of the circle with a given radius by using formula pi * r**2.
- Print result.
# import math module from math import pi # take input from user r = float(input ("Input the radius of the circle : ")) # compute the area from radius of a circle given by user calculateArea = str(pi * r**2); #print result print ("The area of the circle with radius " + str(r) + " is: " + calculateArea)
After executing the program, the output will be:
Input the radius of the circle : 2 The area of the circle with radius 2.0 is: 12.566370614359172
Recommended Python Tutorials
Recommended:-Python Program to Print Alphabets from A to Z
Recommended:-Python Program to Find Roots of Quadratic Equation
Recommended:-Python Program to Find the Variance
Recommended:-How to Check Python Program Execution Time
Recommended:-Python Program Find Day of Week For Given Date
Recommended:-Python Program to Print Sum of All Array Elements
Recommended:-Python Program to Find the GCD of Two Numbers
Recommended:-Python Program to Find the LCM of the Array Elements