def fib(n):
if n > 2 : return fib(n - 1) + fib(n - 2)
else : return 1
n = int(input())
if n > 1 :
for i in range(1 , n + 1):
if i > 1:
if (i - 1) % 5 == 0:
print()
else :
print(' ' , end = '')
print('%11d' % fib(i) , end = '')
print()
else:
print('invalid !')
运行实况D:\0002.Exercise\Python>python x.py
38
1 1 2 3 5
8 13 21 34 55
89 144 233 377 610
987 1597 2584 4181 6765
10946 17711 28657 46368 75025
121393 196418 317811 514229 832040
1346269 2178309 3524578 5702887 9227465
14930352 24157817 39088169
D:\0002.Exercise\Python>
|