filmov
tv
Python Program which Accepts Radius of Circle and Compute Area
Показать описание
In this article, we are going to explore some basic functionality of python, which is the most liked programming language in the world. Many programs can be written in the Python language but today we are going to write a small program which accepts the radius of a circle from the user and can compute the area of the circle. Before writing the program, we must have knowledge of how to calculate the area from the radius. It is a basic math formula to complete the task.
In order to calculate the area from radius, we need to multiply the given value with the π and then the square of radius. Meaning thereby that (pi*radius²). To those who don’t know about pi; it is the ratio of a circle regardless of its size. Value of Pi is approximately equal to 3.14; however, in python we do not need to give its value. We just need to import pi from the math library and it will do the task for us.
Thus, the formula for computing radius is:
area = pi * radius ** 2
Read More At:
In order to calculate the area from radius, we need to multiply the given value with the π and then the square of radius. Meaning thereby that (pi*radius²). To those who don’t know about pi; it is the ratio of a circle regardless of its size. Value of Pi is approximately equal to 3.14; however, in python we do not need to give its value. We just need to import pi from the math library and it will do the task for us.
Thus, the formula for computing radius is:
area = pi * radius ** 2
Read More At: