1 1.def func_out(rate): 2 2. def func_in(money): 3 3. print(rate * money) 4 5 4. return func_in 6 7 5.usa_rate = func_out(0.7) 8 6.usa_rate(100)
1.def func_out(func): 2. def func_in(): 3. print("驗證") 4. func() 5. return func_in 6.@func_out 7.def login(): 8. print("登陸") 9.login()
def func_out(func): def func_in(*args,**kwargs): return func(*args,**kwargs) return func_in @func_out def login(*args,**kwargs): print(args) print(kwargs)
1.def func_out01(func01): 2. print("func_out01 is show") 3. def func_in01(): 4. print("func01 is show") 5. func01() 6. return func_in01 7.def func_out02(func02): 8. print("func_out02 is show") 9. def func_in02(): 10. print("func02 is show") 11. func02() 12. return func_in02 13.@func_out02 14.@func_out01 15.def login(): 16. print('login is show') 17.login() 答案: func_out01 is show func_out02 is show func02 is show func01 is show login is show