{"id":22914,"date":"2021-09-29T20:13:59","date_gmt":"2021-09-29T14:43:59","guid":{"rendered":"https:\/\/python-programs.com\/?p=22914"},"modified":"2021-11-22T18:35:36","modified_gmt":"2021-11-22T13:05:36","slug":"python-program-for-area-of-a-circumscribed-circle-of-a-square","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-area-of-a-circumscribed-circle-of-a-square\/","title":{"rendered":"Python Program for Area of a Circumscribed Circle of a Square"},"content":{"rendered":"
In the previous article, we have discussed Python Program to Check if a given Circle lies Completely Inside the Ring formed by Two Concentric Circles<\/a> Formula:<\/strong><\/p>\n (pi * s* s)\/2<\/p>\n where pi= 3.14159265<\/p>\n s = side length of square.<\/p><\/blockquote>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Below are the ways to calculate the area of a circumscribed circle around the given square in python:<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Access the big list of Python Programming Code Examples<\/a> with actual logical code asked in Programming and Coding Interviews for Python and stand out from the crowd.<\/p>\n In the previous article, we have discussed Python Program to Check if a given Circle lies Completely Inside the Ring formed by Two Concentric Circles Given the side length of a square, the task is to calculate the area of a circumscribed circle around the given square. Formula: (pi * s* s)\/2 where pi= 3.14159265 …<\/p>\n
\nGiven the side length of a square, the task is to calculate the area of a circumscribed circle around the given square.<\/p>\nGiven side of square = 5<\/pre>\n
The area of an circumscribed circle is for a given square of side { 5 } = 39.27<\/pre>\n
Given side of square = 8<\/pre>\n
The area of an circumscribed circle is for a given square of side { 8 } = 100.53<\/pre>\n
Program for Area of a Circumscribed Circle of a Square in Python<\/h2>\n
\n
Method #1: Using Mathematical Formula (Static Input)<\/h3>\n
\n
# Create a function to say Find_areacircumscribdcirle() which takes the given side\r\n# length of the square as an argument, and returns the area of a circumscribed\r\n# circle around the given square.\r\n\r\n\r\ndef Find_areacircumscribdcirle(sideof_sqre):\r\n # Inside the function, calculate the area of a circumscribed circle around the given\r\n # square using the above mathematical formula and store it in a variable.\r\n circl_area = (sideof_sqre * sideof_sqre * (pi \/ 2))\r\n # Return the above result.\r\n return circl_area\r\n\r\n\r\n# Give the side of a square as static input and store it in a variable.\r\nsideof_sqre = 5\r\n# Take a variable and initialize it with the pi value of 3.14159265.\r\npi = 3.14159265\r\n# Pass the given side length of the square as an argument to the\r\n# Find_areacircumscribdcirle() function and store it in another variable.\r\nfnl_rsltarea = Find_areacircumscribdcirle(sideof_sqre)\r\n# Print the above result by rounding off to the 2 places after the decimal point using\r\n# the round() function.\r\nprint(\"The area of an circumscribed circle is for a given square of side {\", sideof_sqre, \"} = \",\r\n round(fnl_rsltarea, 2))\r\n<\/pre>\n
The area of an circumscribed circle is for a given square of side { 5 } = 39.27<\/pre>\n
Method #2: Using Mathematical Formula (User Input)<\/h3>\n
\n
# Create a function to say Find_areacircumscribdcirle() which takes the given side\r\n# length of the square as an argument, and returns the area of a circumscribed\r\n# circle around the given square.\r\n\r\n\r\ndef Find_areacircumscribdcirle(sideof_sqre):\r\n # Inside the function, calculate the area of a circumscribed circle around the given\r\n # square using the above mathematical formula and store it in a variable.\r\n circl_area = (sideof_sqre * sideof_sqre * (pi \/ 2))\r\n # Return the above result.\r\n return circl_area\r\n\r\n\r\n# Give the side of a square as user input using the float(input()) function and\r\n# store it in a variable.\r\nsideof_sqre = float(input(\"Enter some random number = \"))\r\n# Take a variable and initialize it with the pi value of 3.14159265.\r\npi = 3.14159265\r\n# Pass the given side length of the square as an argument to the\r\n# Find_areacircumscribdcirle() function and store it in another variable.\r\nfnl_rsltarea = Find_areacircumscribdcirle(sideof_sqre)\r\n# Print the above result by rounding off to the 2 places after the decimal point using\r\n# the round() function.\r\nprint(\"The area of an circumscribed circle is for a given square of side {\", sideof_sqre, \"} = \",\r\n round(fnl_rsltarea, 2))\r\n<\/pre>\n
Enter some random number = 8\r\nThe area of an circumscribed circle is for a given square of side { 8.0 } = 100.53<\/pre>\n
\n