Answered step by step
Verified Expert Solution
Link Copied!

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. image text in transcribed

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 textbook

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

List the advantages of taking a top-down approach to design.

Answered: 1 week ago