ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## 坐标移动 ```python def startPostion(a=0, b=0): postion = [a, b] def move(x=1, y=1): postion[0] += x postion[1] += y return postion return move ``` ```python action = startPos(0,0) action(1,2) [1, 2] action() [2, 3] ``` ## 计数器 ~~~python def counter(a=0): current = [a] def add_one(x=1): current[0] += x return current[0] return add_one c = counter() print(c()) print(c(2)) ~~~