More Fun with Turtles

Wrong Angles

In the last exercise, we told you that the angle of turn is equal to 360 / number_of_sides. What happens if you use the wrong angle?

import turtle turtle.speed(10) for a in range(100): turtle.forward(100) turtle.left(92) # Try a different angle and see the effect!

Here we are repeating 100 times, so to speed things up, we are using the speed function.

turtle.speed(1)   # Slowest speed
turtle.speed(6)   # Normal speed
turtle.speed(10)  # Very fast
turtle.speed(0)   # Fastest speed

Ex 1.

Modify the program to make it change color as it draws each line. You may use any colors you like.

Ex 2.

In the above program, we didn't use the variable a. Try using it in the loop, by replacing the forward(100) with forward(a). How else can you use a in the loop?

Circles

We can also draw circles using the circle command...

import turtle turtle.circle(50)

Ex 3.

Write a program to draw this figure...

Loops 1 Hint: You should use a loop.

Ex 4.

This one is a little harder...

Loops 2 Hint: You should use a loop, as well as the up and down commands.