Python-100-Days/Day01-15/code/Day07/fibonacci.py

21 lines
297 B
Python
Raw Normal View History

2018-04-27 00:00:22 +08:00
"""
生成斐波拉切数列
Version: 0.1
Author: 骆昊
Date: 2018-03-06
"""
def main():
2019-05-03 21:17:36 +08:00
f = [1 , 1]
for i in range(2, 20):
f += [f[i - 1] + f[i - 2]]
# f.append(f[i - 1] + f[i - 2])
for val in f:
print(val, end=' ')
2018-04-27 00:00:22 +08:00
if __name__ == '__main__':
2019-05-03 21:17:36 +08:00
main()