Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program will prompt the user for the following: a positive (not 0) number o

ID: 3872115 • Letter: T

Question

This program will prompt the user for the following:

a positive (not 0) number of sides (for the regular polygon to be drawn)

a positive (not 0) length of the sides

a color (string)

and then draw a regular polygon with that number of sides, and the specified side length, in the specified color.

Refer to the screen's textinput and numinput methods.(below)

must be done using python. Thank you!

turtle.textinput (title, prompt) Parameters:. title string prompt - string Pop up a dialog window for input of a string. Parameter title is the title of the dialog window, prompt is a text mostly describing what information to input. Return the string input. If the dialog is canceled, return None >>>screen.textinput("NIM", "Name of first player:") turtle. numinput(title, prompt, default-None, minval-None, maxval-None) Parameters: title string prompt string default- number (optional) minval number (optional) maxval - number (optional) Pop up a dialog window for input of a number. title is the title of the dialog window, prompt is a text mostly describing what numerical information to input. default default value, minval: minimum value for input, maxval: maximum value for input The number input must be in the range minvalmaxval if these are given. If not, a hint is issued and the dialog remains open for correction. Return the number input. If the dialog is canceled, return None screen.numinput("Poker", "Your stakes:", 1000, minval-10, maxval-10000)

Explanation / Answer

#! /usr/bin/python


import turtle
wn = turtle.Screen()
polygon = turtle.Turtle()

num_sides =int input("Enter Number of sides of polygon: should be more than 0 ")
side_length = input("Enter lenghth of sides of polygon: should be more than 0!! ")
colors = input("Enter the color of side: [example blue, green, white, yellow]; It must be in quotes: " )

polygon.color(colors)              # make color of polygon
polygon.pensize(3)                 # set the width of her pen


angle = 360.0 / num_sides

for i in range(num_sides):
    polygon.forward(side_length)
    polygon.right(angle)
  
turtle.done()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote