RE: Computation Contest #8 [2 SBI]

You are viewing a single comment's thread from:

Computation Contest #8 [2 SBI]

in programming •  5 years ago 

fibonnaci word.png

from turtle import *

def draw(word,lenght):
    i=1
    for w in word:
        forward(lenght)
        if w=="0":
            if i%2==0:
                left(90)
            else:
                right(90)
        i+=1

def fibonacciWord(n):
    if n==1:
        return "1"
    if n==2:
        return "0"
    return fibonacciWord(n-1)+fibonacciWord(n-2)

n=30
lenght=1 
w=fibonacciWord(n)
penup()
goto(-250,500)
pendown()
tracer(100)
draw(w,lenght)

Fibonacci word

A classic to learn fractal and turtle with python!

clear, precise, incisive

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!