Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # key should be unique but value can be 'same' or any python object
- # unordered (doesnot support indexing or slicing)
- # mutable object
- a = {}
- type(a)
- countries = {'np':'Nepal','ch':'China','us':'United States',}
- countries['np']
- countries.get('ch')
- #methods in dictionaries
- dir(a)[-11:]
- #
- b = a.fromkeys('rahul')
- b['r'] = 5
- print(b['r'])
- OUTPUT : 5
- #
Add Comment
Please, Sign In to add comment