Discuss / Python / Answers from Maplin on 2022-11-28

Answers from Maplin on 2022-11-28

Topic source

>>> def createCounter():

...     x = 0

...     def counter():

...             nonlocal x

...             x = x + 1

...             return x

...     return counter

...


  • 1

Reply