摘要: #ATM 练习 def login(): print("登陆功能") def transfer(): print("转账功能") def check_balance(): print("查询余额") def register(): print("注册功能") while True: print("" 阅读全文
posted @ 2020-12-13 21:49 正霜霜儿 阅读(91) 评论(0) 推荐(0) 编辑
摘要: #1.可以把函数当作变量去用,可以赋值# func=内存地址 def func(): print("from func") f=func print(f,func) f() func() <function func at 0x105f071f0> <function func at 0x105f0 阅读全文
posted @ 2020-12-13 21:45 正霜霜儿 阅读(74) 评论(0) 推荐(0) 编辑
摘要: nonlocal 学习:修改函数外层函数包含名字对应的值(不可变类型)示范1: x=11 def f1(): x=22 def f2(): x=33 print(x) #输出f2的值 f2() print(x)#输出的是f1的值 f1() print(x)#输出的就是全局的值 33 22 11 示范 阅读全文
posted @ 2020-12-13 10:42 正霜霜儿 阅读(266) 评论(0) 推荐(0) 编辑