Please help!
I need to write a programe, that would draw a picture like this:
http://yfrog.com/6ptreelj
I've tried with recoursion but it doesn't work properly.

from turtle import *

tree(n, lenght):
     if n == 0:
          lt(90)
          fd(lenght)
          rt(45)
          fd(lenght/2)
          bk(lenght/2)
          lt(90)
          fd(lenght/2)
          bk(lenght/2)
          rt(45)
     else:
          rt(135)
          tree(n-1, lenght/2)
from turtle import *
def drevo(n, dolzina, zelva):
    if n == 0:
        zelva.lt(90)
        zelva.fd(dolzina)
        zelva.rt(33)
        zelva.fd(dolzina*(2/3))
        zelva.bk(dolzina*(2/3))
        zelva.lt(66)
        zelva.fd(dolzina*(2/3))
        zelva.bk(dolzina*(2/3))
        zelva.rt(33)
    else:
        drevo(0, dolzina, zelva)
        zelva.rt(123)
        drevo(n-1, dolzina*(2/3), zelva)
        zelva.bk(dolzina*(2/3))
        zelva.rt(24)
        drevo(n-1, dolzina*(2/3), zelva)
        zelva.bk(dolzina*(2/3))
        zelva.rt(33)

Words are in Slovenian language, cause I'm from Slovenia. Drevo means tree, dolzina means lenght, zelva means turtle. :)

Edited 6 Years Ago by Binika: n/a

Comments
nice
This question has already been answered. Start a new discussion instead.