Description

In this tutorial, we will learn all about the circle ( area, circumference ) with all types of method. Inbuild Methods, function, simple so on. You can write the Program to calculate area of a circle and, also calcuate the operation below...

  • Calculate the area of a circle in Python Programming language
  • Find the area of a circle using function in Python
  • Find the area of a circle using the math module in python
  • Python program to calculate the area and circumference of a circle
  • Python program to calculate the area and circumference of a circle using an inbuild math module
  • Python program to find the area and perimeter of a circle

Calculate the area of a circle in Python Programming language

  • Take input from the user using input() function for radius and store in a variable
  • Use constant variable to store the value of "PI".
  • And, Calculate the area of a circle with the formula area = PI * r *r.
  • And, in Last, print the area of circle
r = float(input("Enter the radius of Circle : " ))
PI = 3.14

area = PI * r * r

print("Area : ",area)


'''
#Output:
Enter the radius of Circle : 2
Area :  12.56

'''

Find the area of a circle using function in Python

  • defined a function as def area_of_circle().
def area_of_circle(r):
    PI = 3.14
    return PI * r * r

r = float(input("Enter the radius of Circle : "))
print("Area : %.6f" % area_of_circle(r)) 

'''
#Output

Enter the radius of Circle : 3
Area : 28.260000

''' 

Find the area of a circle using the math module in python

  • import math module which is inbuilt module
  • take the input radius from the user
  • now, calculate the area of using this formula area = math.pi * r * r. The value of "pi" is taken from the "math" module
  • And, print the area of circle
import math

r = float(input("Enter the radius of Circle : "))

area = math.pi * r * r

print("Area : ", area)


'''
#Output:
Enter the radius of Circle : 2
Area :  12.566370614359172

'''

Python program to calculate the area and circumference of a circle

  • Take input from the user using input() function for radius and store it in a variable.
  • use constant to store the value of "PI".
  • Now, calculate the area of circle by using formula area = PI * r * r.
  • And Caluclating the circumference of a circle, using the formula circumference = 2 * PI * r.
  • print the area and circumference of a circle.
PI = 3.14

r = float(input("Enter the radius of Circle : "))

area = PI * r * r

circumference = 2 * PI * r

print("Area of Circle : ", area)

print("Circumference of Circle : ", circumference)

'''
#Output:
Enter the radius of Circle : 5
Area of Circle :  78.5
Circumference of Circle :  31.400000000000002

'''

Python program to calculate the area and circumference of a circle using an inbuild math module

import math

r = float(input("Enter the radius of Circle : "))

area = math.pi * r * r

circumference = 2 * math.pi * r

print("Area of Circle : ",area)
print("Circumference of Circle : ", circumference)


'''
#Output:
Enter the radius of Circle : 5
Area of Circle :  78.53981633974483
Circumference of Circle :  31.41592653589793


'''

Python program to find the area and perimeter of a circle

  • Take input from the user using input() function for radius of circle 
  • use constant to store the value of "PI".
  • Calculate the area of circle using the formula area = PI * r * r
  • and calculating the perimeter of a circle we will use the formula perimeter = 2 * PI * r
  • print the area and perimeter of circle
PI = 3.14

r = float(input("Enter the radius of circle : "))

area = PI * r * r
perimeter = 2 * PI * r

print("Area of Circle : ", area)
print("Perimeter of Area : ", perimeter)

'''
#Output:
Enter the radius of circle : 6
Area of Circle :  113.03999999999999
Perimeter of Area :  37.68

'''

 

Comments

Login is mandatory to comment Please login

Recommended Posts

leap year in python

The year which has 366 days is called a leap year. This additional day is added in february which makes it 29 days long.

Fibonacci Series | Fibonacci Sequence in Python

Fibonacci numbers ( series ) is a set of numbers that start with 1 or 0 followed by a 1 proceeds on the rule that each number.

Find maximum of two number in python programming language

Maximum of two number in Python - Using max() function , Using if else statement, Using Ternary operator and Using Lambda function.