python-闭包

def fn():
# global num
num = 10
print(num)


def func():
# num = 10
print(num)
return func
func=fn()
func()

def father(money):

def son(someone):
print('和%s一起使用%s元钱'% (someone,money))
return son
money=int(input('发工资:'))
son=father(money)
son('小明')
posted @ 2019-11-20 23:08  灰色轨迹8554  阅读(118)  评论(0)    收藏  举报