# make the turtle graphics module available import turtle # also make the random module available import random # set up our graphical canvas # width = 500, height = 500 turtle.setup(500, 500) # get a stroke color stroke = input("Enter a color for the stroke of your shape: ") # make sure we have a valid stroke color before continuing if stroke == "yellow" or stroke == "red" or stroke == "green" or stroke == "blue": # stroke is good! # get a fill color fill = input("Enter a color for the fill of your shape: ") # make sure the fill color is valid before continuing if fill == "yellow" or fill == "red" or fill == "green" or fill == "blue": # fill is good! # set the pen color turtle.pencolor(stroke) # set pen size turtle.pensize(5) # set our fill color turtle.fillcolor(fill) # start filling our shape turtle.begin_fill() # draw a square turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) turtle.forward(100) turtle.right(90) # stop filling our shape turtle.end_fill() # fill is bad! else: print ("Sorry, that's not a valid fill color") turtle.bye() # stroke is invalid else: print ("Sorry, that's not a valid color") turtle.bye()