Acer1968

LUA anonymní funkce do Pythonu 2

Feb 22nd, 2022 (edited)
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. def counter():
  2.     count = 0
  3.  
  4.     return lambda count: count + 1
  5.  
  6.  
  7. x = counter()
  8.  
  9.  
  10. print(x())
  11. print(x())
  12. print(x())
  13. print(x())
  14. print(x())
  15. print(x())
  16.  
  17.  
  18. """
  19. Vyhodí chybu:
  20. ----------------------------
  21. Traceback (most recent call last):
  22.  File "d:\LuaProjects\test.py", line 10, in <module>
  23.    print(x())
  24. TypeError: <lambda>() missing 1 required positional argument: 'count'
  25. ----------------------------
  26. """
Add Comment
Please, Sign In to add comment