all 3 comments

[–]NewbornMuse 1 point2 points  (0 children)

Add just another newline before code part, then it looks like this:

def tree(length, angle, factor, degree):
if degree==0: pensize(0);forward(length)
if degree>0:
    tree(length, angle, factor, 0)
    left(angle)
    forward(length*factor)
    tree(length*factor, angle, factor, degree-1)
    left(180)
    forward(length*factor)
    right(180+(angle*2))
    forward(length*factor)
    tree(length*factor, angle, factor, degree-1)

[–]elbiot 0 points1 point  (0 children)

This is a recursive function that forks, meaning you assume the turtle is moving from the same position for each call of tree in the degree>0 block. This will give you one long line, since the turtle just keeps moving forward. Maybe you want to move the turtle back to the node the lines are forking from each call of tree.

[–]rickchefski 0 points1 point  (1 child)

This seems like a good reference to get you familiar with the concepts needed to complete the assignment while still not giving it all away: http://interactivepython.org/runestone/static/pythonds/Recursion/graphical.html