Python递归数列(斐波那契数列)
n=int(input("please input n: "))x1=1x2=1count=2print("{:>8}{:>8}".format(x1,x2),end="")for i in range(3,n+1): x3=x1+x2 print("{:>8}".format(x3),end="") count+=1 if count%4==0: print() x1=x2 x2=x3运行结果:please
原创
2021-03-15 11:27:47 ·
591 阅读 ·
0 评论