def bona(): while True: n = (input(‘你想打印几个数的斐波那契数列:‘)) if not n.isdigit(): exit() a,b,m = 0,1,0 n = int(n) A = ‘‘ while m < n: a,b = b,a+b m += 1 A = ‘‘‘%s %s‘‘‘ %(A,str(a)) else: print(A) bona()
本文出自 “ProgressEveryd” 博客,请务必保留此出处http://987774031.blog.51cto.com/11704329/1942054
原文地址:http://987774031.blog.51cto.com/11704329/1942054