Feb-28-2019, 08:43 AM
The following is an exercise question from tutorial course and my code.
Write a program that asks the user for the number of sides, the length of the side, the color, and the fill color of a regular polygon. The program should draw the polygon and then fill it in.
Write a program that asks the user for the number of sides, the length of the side, the color, and the fill color of a regular polygon. The program should draw the polygon and then fill it in.
import turtle wn = turtle.Screen() alex = turtle.Turtle() sides = input ("Number of sides in polygon?" ) length = input ("Length of the sides in polygon?" ) colorname = input ("Color of polygon?" ) fcolor = input ("Fill color of polygon?") alex.color = (colorname) alex.fillcolor = (fcolor) for i in range(sides): alex.forward (length) alex.left (360 / sides)Input pop-ups work, but otherwise, no output.