1 ImportTurtle#allows us to use the Turtles library2WN = Turtle. Screen ()#creates a graphics window3Wn.bgcolor ("LightGreen")#set the window background color4 5Alex = Turtle. Turtle ()#Create a turtle named Alex6Alex.pensize (3)#Set the width of her pen7Alex.color ("Pink")#Make Alex pink color is attribute8Alex.forward (150)#Tell Alex to move forward by units9Alex.left (90)#turn by degrees, right was clockwise, left is counter clockwiseTenAlex.forward (75)#Complete the second side of a rectangle OneAlex.left (90) AAlex.forward (150) -Alex.left (90) -Alex.forward (75) the -Tess =Turtle. Turtle () -Tess.color ("Hotpink") -Tess.pensize (5) + -Tess.forward (150) +Tess.left (120) ATess.forward (150) atTess.left (120) -Tess.forward (150) - -David =Turtle. Turtle () -David.color ("Blue") -David.pensize (5) in - forIinch["Yellow","Red","Purple","Blue"]: to David.color (i) +David.forward (150) -David.left (90) the *Wn.exitonclick ()#wait for a user click on the canvas
Python-turtle Graphics