Turtles

Did you manage to complete the first turtle project?

Can you make an interesting repeating geometric pattern of your own using the for loops? There’s a good example of a star in the Python Turtle Documentation. Can you find any others.

In the second turtle project you’ll learn how to use functions. Here’s an interesting one to try that uses a recursive function. (Which is one that calls itself.) I found this using a google image search on ‘python turtle examples

from turtle import *
def striangle(depth,base):
 down()
 if depth == 0:
 begin_fill()
 for i in 0,1,2:
 forward(base)
 left(120)
 end_fill()
 else:
 for i in 0,1,2:
 striangle(depth-1,base)
 up()
 forward(base*2**depth)
 left(120)
 down()
reset()
striangle(6,5)

3 thoughts on “Turtles

  1. I completed the Bescii Project. I found it really fun and interesting. It showed you all the Debugging things and how to make the ART.

      

    • Priya, well done! I’m glad you enjoyed it. I must have a go at it myself! Maybe you can tell us all about it at Code Club tonight?

        

Leave a Reply

Your email address will not be published. Required fields are marked *