Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in Python please. Goals: using loops and turtle graphics Problem: You are going to create a Python program that will draw a regular polygon

Code in Python please.

image text in transcribed

Goals: using loops and turtle graphics 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

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

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions