Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone code this in Python. Problem: You are going to create a Python program that will draw a regular polygon (one with each side
Can someone code this in Python.
Problem: You are going to create a Python program that will draw a "regular" polygon (one with each side of the same length and each angle of the same size) with number of sides between 3 and 12 as chosen by the user. Your code should prompt the user to enter the number of sides he/she would like to see. Use a while loop to robustly (repeatedly) confirm that the number of sides is in the range of 3 and 12 including 3 and 12. (A message should be output to the user stating what is wrong and the user should be prompted to enter a new value.) Next use either a for loop or a while loop and turtle to draw the polygon with side of 60 pixels and a color other than black. Use a pen size of 6. The angle to turn left or right may be calculated as 360 divided by the number of sides. For example, the angle for a 12-sided polygon is 360/12 or 30. The angle for 6-sided polygon is 60 degrees. An example of a 12-sided polygon using a pen color of orange and a 6-sided polygon using a pen color of dark sea green is given below Think about which commands should be repeated and which commands should not be repeated. Do not put commands that do not need to be repeated inside a loop. The necessary turtle commands mav be found in Section 2,10 "Introductions to Turtle Graphics'" (section 10 of chapter 2) in your textbookStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started