Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> def kwadrat(x):
- ... return x*x
- ...
- >>> d = {}
- >>> d[1]
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- KeyError: 1
- >>> d[1] = 'abc'
- >>> d[1]
- 'abc'
- >>> d[1] = kwadrat
- >>> d[1](5)
- 25
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement