<\/span><\/h2>\n\n\n\n# Python Program to Find Area of Circle Using Constant \u03c0\n\nPI = 3.14\nr = float(input(\"Enter the radius of the circle: \"))\narea = PI * r * r\n\nprint(\"Area of the circle = %.2f\" %area)\n\n<\/pre>\n\n\n\nOutput<\/strong><\/p>\n\n\n\nEnter the radius of the circle: 14\r\nArea of the circle = 615.44\r<\/code><\/pre>\n\n\n\n<\/span>How Does This Program Work?<\/strong><\/span><\/h2>\n\n\n\n\n- In this program, we store the value of \u03c0<\/strong> in the PI<\/strong> named constant variable.<\/li>\n\n\n\n
- Now, the user is asked to enter the radius of the circle. It is stored in the r<\/strong> named variable.<\/li>\n\n\n\n
- The area of the circle is calculated using the formula \u03c0r2<\/sup><\/strong>. The area of the circle is stored in the area<\/strong> named variable.<\/li>\n\n\n\n
- The calculated area of the circle is printed up to 2<\/strong> decimal places with the help of %.2f<\/strong> format specifier.<\/li>\n<\/ol>\n\n\n\n
<\/span>Python Program to Find Area of Circle Using math Module<\/strong><\/span><\/h2>\n\n\n\nIn the above program, we have stored the value of \u03c0<\/strong> in a separate variable. To get more precise and accurate results, we will use the math<\/strong> module.<\/p>\n\n\n\nPython has a built-in module called math<\/strong> that provides access to different mathematical constants and functions. It also contains the value of \u03c0<\/strong>.<\/p>\n\n\n\n# Python Program to Find Area of Circle Using math Module \nimport math\n\nr = float(input(\"Enter the radius of a circle: \"))\narea = math.pi * r * r\n\nprint(\"Area of the circle = %.2f\" %area)\n<\/pre>\n\n\n\nOutput<\/strong><\/p>\n\n\n\nEnter the radius of a circle: 7\r\nArea of the circle = 153.94\r<\/code><\/pre>\n\n\n\nTo use the value of \u03c0<\/strong>, use math.pi<\/strong> in the program.<\/p>\n\n\n\n<\/span>Summary<\/strong><\/span><\/h2>\n\n\n\nAfter going through this post, I hope you understand how to find the area of a circle using the Python Programming language.<\/p>\n","protected":false},"excerpt":{"rendered":"
In this post, we will learn how to find the area of a circle using the Python Programming language.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[91,417],"tags":[806],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/8303"}],"collection":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/comments?post=8303"}],"version-history":[{"count":3,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/8303\/revisions"}],"predecessor-version":[{"id":8306,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/8303\/revisions\/8306"}],"wp:attachment":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/media?parent=8303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/categories?post=8303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/tags?post=8303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}