1,2,3,5,8,13。。。。。
求第n个数
def get_num(n): if n == 1: return 1 if n == 2: return 2 return get_num(n - 1) + get_num(n - 2)
def get_num(n): if n == 1: return 1 if n == 2: return 2 a = 1 b = 2 for i in range(n - 2): a, b = b, a + b return b分为递归和循环两个求法