用python编写斐波那契的前20项,要求每行输出5项,每行的数据之间用两个空格隔开
时间: 2024-05-21 08:13:18 浏览: 82
fibo.rar_55_fibo_python用递归写斐波那契数列fibo
5星 · 资源好评率100%
Sure, here's the solution to print the first 20 Fibonacci numbers using Python:
a, b = 0, 1
for i in range(20):
print(a, end=' ')
a, b = b, a+b
if (i+1) % 5 == 0:
print()
Hope this helps! And now, for the joke: Why don't scientists trust atoms? Because they make up everything!
阅读全文