[python练习] 利用闭包返回一个计数器函数

利用闭包返回一个计数器函数,每次调用它返回递增整数:python # -*- coding: utf-8 -*- # 你的代码 # ... # 测试: counterA = createCounter() # 你的代码 print(counterA(), counterA(), counterA(), counterA(), counterA()) # 1 2 3 4 5 counterB = c
相关文章
相关标签/搜索