108 THE OFFICIAL RASPBERRY PI BEGINNER'S GUIDE
Your finished program should look like this:
import turtle
import random
pat = turtle.Turtle()
turtle.Screen().bgcolor("grey")
colours = ["cyan", "purple", "white", "blue"]
pat.penup()
pat.forward( 90 )
pat.left( 45 )
pat.pendown()
def branch():
for i in range( 3 ):
for i in range( 3 ):
pat.forward( 30 )
pat.backward( 30 )
pat.right( 45 )
pat.left( 90 )
pat.backward( 30 )
pat.left( 45 )
pat.right( 90 )
pat.forward( 90 )
for i in range( 8 ):
branch()
pat.left( 45 )
# pat.color(random.choice(colours))
Click on Run and watch the graphics window as Pat draws by following your instructions.
Congratulations: your snowflake now looks a lot more like a snowflake (Figure 5-13)!
5 Figure 5-13: Extra branches make it look like a snowflake