def fib(x=0,y=0):
def returnFib():
nonlocal x,y
if x == 0 and y == 0:
x = 0
y = 1
elifx == 0 and y == 1:
x = 1
y = x+y
else:
x,y = y,x+y
print(y)
return returnFib
f = fib()
# for i in range(1,10):
# print(f())
# i += 1
f() 打卡!{:10_334:} 函数只有在定义和调用时才会用到小括号;将函数作为返回值或参数时,只需要写上函数名,不需要用到小括号 滴滴滴,打个卡 学习
页:
1
[2]