Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. >>> def kwadrat(x):
  2. ... return x*x
  3. ...
  4. >>> d = {}
  5. >>> d[1]
  6. Traceback (most recent call last):
  7. File "<stdin>", line 1, in <module>
  8. KeyError: 1
  9. >>> d[1] = 'abc'
  10. >>> d[1]
  11. 'abc'
  12. >>> d[1] = kwadrat
  13. >>> d[1](5)
  14. 25
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement