如何在python中看到更多的FIbbonaci螺旋?

时间:2016-04-02 13:22:54

标签: python fibonacci

如何在Python中看到很多斐波那契螺旋,但仍然可见? 这是代码:

import time
import turtle
a = turtle.Turtle()
x = 0
y = 0.01
while 0==0 :
    a.forward(y)
    x = x + y
    a.left(90)
    a.forward(x)
    y = x + y
    a.left(90)
    time.sleep(0.02)

1 个答案:

答案 0 :(得分:2)

import time
import turtle
a = turtle.Turtle ()
x = 0
y = 10
factor = 0.55
while True:
    a.forward (y)
    x = factor * (x + y)
    a.left(90)
    a.forward (x)
    y = factor * (x + y)
    a.left (90)
    time.sleep (0.02)

enter image description here