#打印斐波那契数列的第101项 a = 1 b = 1 for count in range(99): a,b = b,a+b else: print(b)
方法2:
#打印斐波那契数列的第101项 a = 1 b = 1 for i in range(2,101): if i == 100: print(a+b) b += a a = b-a