DICTIONARY
1.keys-To get all the keys in dictionary
command: d.keys()
2.values-to get all the values in dictionary
command: d.values()
3.items-shows the dictionary as a set
command: d.items()
4.get-to obtain the value by giving a key
command: d.get(key)
5.setdefault-where a new key is added with a default value-'none'
command: d.setdefault(key)
6.update-where a new key and it's corresponding value can be updated
command: d.update({key:value})
7.copy-it copies the dictionary
(i)deep copy- where changes can be reflected after copying the dictionary
command: d1=d
(ii)shallow copy-where changes cannot be reflected,copies the original
dictionary rather than the updated one
command: d.copy()
8.fromkeys-where multiple keys are given to represent the same value
command: d.fromkeys([keys],value)
9.pop-where it pops out the key and it's corresponding value specified
command: d.pop(key)
10.popitem-where it pops out the last key and it's value of the dictionary
command: d.popitem()
11.clear-clears out the entire dictionary
command: d.clear()