{"id":22954,"date":"2021-09-29T20:14:00","date_gmt":"2021-09-29T14:44:00","guid":{"rendered":"https:\/\/python-programs.com\/?p=22954"},"modified":"2021-11-22T18:35:35","modified_gmt":"2021-11-22T13:05:35","slug":"python-program-for-area-of-square-circumscribed-by-circle","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-area-of-square-circumscribed-by-circle\/","title":{"rendered":"Python Program for Area of Square Circumscribed by Circle"},"content":{"rendered":"
In the previous article, we have discussed Python Program for Area of a Circumscribed Circle of a Square<\/a> Formula:<\/strong><\/p>\n The formula to find the area of a square circumscribed by the circle = 2*(radius**2)<\/strong><\/p>\n Where ** indicates power value<\/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 square circumscribed by the circle 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 Find the best practical and ready-to-use Python Programming Examples<\/a> that you can simply run on a variety of platforms and never stop learning.<\/p>\n In the previous article, we have discussed Python Program for Area of a Circumscribed Circle of a Square Given the radius of the circle, the task is to calculate the area of a square circumscribed by the circle. Formula: The formula to find the area of a square circumscribed by the circle = 2*(radius**2) Where …<\/p>\n
\nGiven the radius of the circle, the task is to calculate the area of a square circumscribed by the circle.<\/p>\nGiven radius = 8<\/pre>\n
The area of a square circumscribed by the circle for the given radius{ 8 } = 128<\/pre>\n
Given radius = 5<\/pre>\n
The area of a square circumscribed by the circle for the given radius{ 5 } = 50<\/pre>\n
Program for Area of Square Circumscribed by Circle in Python<\/h2>\n
\n
Method #1: Using Mathematical Formula (Static Input)<\/h3>\n
\n
# Create a function to say Areacircumscribd_square() which takes the given radius of\r\n# the circle as an argument, and returns the area of a square circumscribed\r\n# by the circle.\r\n\r\n\r\ndef Areacircumscribd_square(gvn_radiuss):\r\n # Inside the function, calculate the area of a square circumscribed by the circle\r\n # using the above mathematical formula and store it in a variable.\r\n area_squar = (2 * gvn_radiuss * gvn_radiuss)\r\n # Return the above result.\r\n return area_squar\r\n\r\n\r\n# Give the radius as static input and store it in a variable.\r\ngvn_radiuss = 8\r\n# Pass the given radius as an argument to the Areacircumscribd_square() function and\r\n# store it in another variable.\r\nfnl_rsltarea = Areacircumscribd_square(gvn_radiuss)\r\n# Print the above result by rounding off to the 2 places after the decimal point\r\n# using the round() function.\r\nprint(\"The area of a square circumscribed by the circle for the given radius{\", gvn_radiuss, \"} = \", round(\r\n fnl_rsltarea, 2))\r\n<\/pre>\n
The area of a square circumscribed by the circle for the given radius{ 8 } = 128<\/pre>\n
Method #2: Using Mathematical Formula (User Input)<\/h3>\n
\n
# Create a function to say Areacircumscribd_square() which takes the given radius of\r\n# the circle as an argument, and returns the area of a square circumscribed\r\n# by the circle.\r\n\r\n\r\ndef Areacircumscribd_square(gvn_radiuss):\r\n # Inside the function, calculate the area of a square circumscribed by the circle\r\n # using the above mathematical formula and store it in a variable.\r\n area_squar = (2 * gvn_radiuss * gvn_radiuss)\r\n # Return the above result.\r\n return area_squar\r\n\r\n\r\n# Give the radius as user input using the float(input()) function and store it in a variable.\r\ngvn_radiuss = float(input(\"Enter some random number = \"))\r\n# Pass the given radius as an argument to the Areacircumscribd_square() function and\r\n# store it in another variable.\r\nfnl_rsltarea = Areacircumscribd_square(gvn_radiuss)\r\n# Print the above result by rounding off to the 2 places after the decimal point\r\n# using the round() function.\r\nprint(\"The area of a square circumscribed by the circle for the given radius{\", gvn_radiuss, \"} = \", round(\r\n fnl_rsltarea, 2))\r\n<\/pre>\n
Enter some random number = 5\r\nThe area of a square circumscribed by the circle for the given radius{ 5.0 } = 50.0<\/pre>\n
\n