Fibonacci Sequence The Golden Ratio In Python Code 2018

preview_player
Показать описание
Check out this awesome short introduction to the Fibonacci sequence or the Golden Ratio. I'll show you a very short and sweet python code that will print out the Fibonacci number you want, no matter how far down the rabbit hole it is. Here is a source code for infinite Fibonacci in slow motion:
#!/usr/bin/env python
import time
# 1:1.618 " The Golden Ratio "
# 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

def main():
x=1; # for infinite loop
a, b = 0, 1
print(0)
while x==1:
print(a)
print('\n')
a, b = b, a + b # a=b, b=a+b

main()
Рекомендации по теме