- Write a Python program (with comments) to do the following:
- Define a functioncalc_angle(n)that calculates the interior angle of a regularpolygon with nsides and returns this value. Use the following formula:
angle =(n-2)*180/n
- In the main program, ask the user to input thenumber of sides of the regular polygon and assign the numericalvalue to variablenum_sides.Assume a valid entry will be given.
- Call the above function with itsnum_sides asits input and print the value returned by the function with asuitable message.
- Save your code to a file with namelab9sol.py.
- Submit your Python code (i.e.lab9sol.py file) throughBB.
A sample output is shown below.
Sign in Upgrade – 0 X + Imert Rye Layout Delcreness levien View Section cloud Q Click to find commande WWFs Office labs. doc x = Menu Home Xother New Roman 2 Paste cap Format BIV -A-XX A 2 AA 22. SE A A – A – ABOCA ABLABCAaBbc. A Nora Heading Heading 2 Headings, New Style Q Tee Topia Find and Select Settings Le Python 3.6.2 Shell File Edit Shell Debug Options Window Help ====== RESTART: C:UsersArunita JaekelDropbo x106LABSF19lab9sol.py === Enter the number of sides in your polygon: 4 The interior angle of a regular polygon with 4 sides is: 90.0 >>> ====== RESTART: C:UsersArunita JaekelDropbo x106LABSF19lab9sol.py ===== Enter the number of sides in your polygon: 7 The interior angle of a regular polygon with 7 sides is: 128.57142857142858 >>> ====== RESTART: C:UsersArunita JaekelDropbo x106LABSF19lab9sol.py ====== Enter the number of sides in your polygon: 10 The interior angle of a regular polygon with 1 0 sides is: 144.0 2003 297*. – E H H Pape Nume: 1 Page 11 Sector 1 SetValue: 2.5in tow Count Word 115/130 2 Suel Che Compatibility Mode ó tial. A. HIMELIE 4 | = A 4 ENG 20191165 Show transcribed image text Sign in Upgrade – 0 X + Imert Rye Layout Delcreness levien View Section cloud Q Click to find commande WWFs Office labs. doc x = Menu Home Xother New Roman 2 Paste cap Format BIV -A-XX A 2 AA 22. SE A A – A – ABOCA ABLABCAaBbc. A Nora Heading Heading 2 Headings, New Style Q Tee Topia Find and Select Settings Le Python 3.6.2 Shell File Edit Shell Debug Options Window Help ====== RESTART: C:UsersArunita JaekelDropbo x106LABSF19lab9sol.py === Enter the number of sides in your polygon: 4 The interior angle of a regular polygon with 4 sides is: 90.0 >>> ====== RESTART: C:UsersArunita JaekelDropbo x106LABSF19lab9sol.py ===== Enter the number of sides in your polygon: 7 The interior angle of a regular polygon with 7 sides is: 128.57142857142858 >>> ====== RESTART: C:UsersArunita JaekelDropbo x106LABSF19lab9sol.py ====== Enter the number of sides in your polygon: 10 The interior angle of a regular polygon with 1 0 sides is: 144.0 2003 297*. – E H H Pape Nume: 1 Page 11 Sector 1 SetValue: 2.5in tow Count Word 115/130 2 Suel Che Compatibility Mode ó tial. A. HIMELIE 4 | = A 4 ENG 20191165
Expert Answer
Answer to Write a Python program (with comments) to do the following: Define a function calc_angle(n) that calculates the interior…