let's add to the file in the previous lesson (see below if you didn't create this file yet.

Add more to Turtle code

Make turns
Add the following code below the "bob.forward(50)" line

bob.right(90)
bob.forward(50)

Notice when you run this that bob turns 90 degrees and then moves again 50 pixels.

Make a square using a for loop

A for loop allows us to repeat a block of code for a certain amount of iterations (range)
IMPORTANT: indentation is important in python. the print(i) must be tabbed over once.

for i in range(4):
    print(i)

How could you Make a square with this loop?

How can you draw a star?

Change Color

bob.pencolor("blue")

or pencolor("#32D486")

Creating Variables

num_sides = 6 
side_length = 70 
angle = 360.0 / num_sides 
for i in range(num_sides): 
    bob.forward(side_length) 
    bob.right(angle)

Penup and PenDown
This gives us the ability to move the turtle around the screen without painting and reposition it before putting the pendown and painting again.

bob.penup()     
bob.setposition(0, 0)     
bob.pendown()

Dots
You can make a dot on the screen using the dot function.

dot_distance = 25
bob.dot()

   
# Step 1: Make all the "turtle" commands available to us. import turtle # Step 2: Create a new turtle. We'll call it "bob" bob = turtle.Turtle() # Step 3: Move in the direction Bob's facing for 50 pixels bob.forward(50) # Step 4: We're done! turtle.done()