Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
Python Program to Find Area of a Circle
Next article icon

Python Program to Find Area of a Circle

Last Updated : 21 Feb, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The task of calculating the Area of a Circle in Python involves taking the radius as input, applying the mathematical formula for the area of a circle and displaying the result.

Area of a circle formula:

Area = pi * r2

where

  • π (pi) is a mathematical constant approximately equal to 3.14159.
  • r is the radius of circle .

For example, if r = 5, the area is calculated as Area = 3.14159 × 5² = 78.53975.

Using math.pi

math module provides the constant math.pi, representing the value of π (pi) with high precision. This method is widely used in mathematical calculations and is considered a standard approach in modern Python programming. It is optimal for general-purpose applications requiring precision and speed.

Python
import math r = 5 # radius  area = math.pi * (r ** 2) print(area) 

Output
78.53981633974483 

Explanation: area is calculated using the formula math.pi * (r ** 2), where r ** 2 squares the radius, and math.pi ensures high precision for π.

Table of Content

  • Using math.pow()
  • Using numpy.pi
  • Using hardcoded pi value

Using math.pow()

math.pow() function is optimized for power calculations, making it more readable when dealing with complex exponents. It is often preferred when working with formulas involving multiple power terms, though it is slightly less common than using ** for simple squares.

Python
import math r = 5 # radius  area = math.pi * math.pow(r, 2) print(area) 

Output
78.53981633974483 

Explanation: math.pi * math.pow(r, 2), where math.pow(r, 2) raises the radius to the power of 2, math.pi ensures the use of a precise value of π.

Using numpy.pi

numpy library is designed for high-performance numerical computations and numpy.pi provides a precise value of π. It is especially efficient when performing bulk area calculations or working with arrays of radii, making it ideal for large-scale computations.

Python
import numpy as np r = 5 # radius  area = np.pi * (r ** 2) print(area) 

Output
78.53981633974483 

Explanation: np.pi * (r ** 2), where np.pi provides a high-precision value of π and r ** 2 squares the radius.

Using hardcoded pi value

This is a simple and traditional approach where the value of π is manually set as a constant . It is often used in basic programs or quick prototypes where precision is not critical. While this method is easy to implement, it is less accurate and is generally not recommended for professional or scientific calculations.

Python
PI = 3.142 r = 5 # radius  area = PI * (r * r) print(area) 

Output
78.55 

Explanation: area is then calculated using the formula PI * (r * r), where r * r squares the radius.


Next Article
Python Program to Find Area of a Circle

K

kartik
Improve
Article Tags :
  • Python
Practice Tags :
  • python

Similar Reads

    Draw a circle using Arcade in Python3
    The arcade library is a high-tech Python Package with advanced set of tools for making 2D games with gripping graphics and sound. It is Object-oriented and is especially built for Python 3.6 and above versions. Arcade inbuilt functions to draw circle :- 1. arcade.draw_circle_outline( ) : This functi
    3 min read
    How to find Definite Integral using Python ?
    Definite integrals are the extension after indefinite integrals, definite integrals have limits [a, b]. It gives the area of a curve bounded between given limits.\int_{a}^b F(x)dxIt denotes the area of curve F(x) bounded between a and b, where a is the lower limit and b is the upper limit.In this ar
    2 min read
    How to Draw a Circle Using Matplotlib in Python?
    A Circle is a mathematical figure formed by joining all points lying on the same plane and are at equal distance from a given point. We can plot a circle in python using Matplotlib. There are multiple ways to plot a Circle in python using Matplotlib.  Method 1: Using matplotlib.patches.Circle() func
    3 min read
    Program to find Perimeter / Circumference of Square and Rectangle
    The circumference of a figure is the sum of all the side lengths. To calculate the circumference of square, length of one of the side is required as all sides are equal. To calculate the circumference of rectangle, length and breadth of rectangle is required. Circumference of a Square:   The circumf
    5 min read
    Make an Circle Glyphs in Python using Bokeh
    Bokeh is a Python interactive data visualization. Unlike Matplotlib and Seaborn, Bokeh renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Plotting the Circle Glyph
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences