# The following program draws a tree # First, notice that we already know enough Python to do some cool stuff! # Call the function with different parameters to determine what each of them does # How does such a simple function result in such a complex figure? # Notice that only the left side of the tree is drawn; can you also draw the right? # Play with the idea to see whether you can get other interesting shapes # Read about fractals on Wikipedia from turtle import * def tree(length, angle, step): if length < step: # this is a conditional. It does just what it sounds like -- the statements inside it are only executed if the condition is true return # exits the function forward(length) left(angle) tree(length / 2, angle, step) right(angle) tree(length / 2, angle, step) right(angle) left(angle) backward(length) speed(100) left(90) tree(200, 30, .5)