For this lab, you are asked to make two Python files. 1. The first file should be named polygon.py 2. It should contain

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

For this lab, you are asked to make two Python files. 1. The first file should be named polygon.py 2. It should contain

Post by answerhappygod »

For This Lab You Are Asked To Make Two Python Files 1 The First File Should Be Named Polygon Py 2 It Should Contain 1
For This Lab You Are Asked To Make Two Python Files 1 The First File Should Be Named Polygon Py 2 It Should Contain 1 (75.12 KiB) Viewed 45 times
For this lab, you are asked to make two Python files. 1. The first file should be named polygon.py 2. It should contain Python functions that a. Compute the perimeter of a regular polygon. You should pass the parameters n and s where n is the number of sides and s is the length of one side. You should return the perimeter b. Compute the area of the polygon. You should pass the parameters, s and n, and you should return the area. Notice that you will have to include code to find the apothem. 3. Write a second Python program that a. is in the same directory as polygon.pyand is called polygontest b. imports polygon c. Allows the user to enter the number of sides and the lengths of the sides until he is finished. d. Below is sample output Enter the length of a side. Enter to quit : 3 Enter number of sides: 4 Number of sides: Length of each side : 3.0 The area is : The perimeter of the polygon is : 12.0 9.000000000000002 Enter the length of a side. Enter to quit :2 Enter number of sides: 5 Number of sides: Length of each side :5 : 2.0 The area is The perimeter of the polygon is : 10.0 Enter the length of a side. Enter to quit : 6.881909602355869 You should submit the files polygon.py and polygontest.py
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply