Ref Video : https://www.youtube.com/watch?v=rpsYzPv1HiQ
Dictionaries
- A Python dictionary is a data structure that stores data in key-value pairs, where each key is unique and is used to retrieve its associated value.
- It is mainly used when you want to store and access data by a name (key) instead of by position like in a list.
keys()---Returns all the keys in your dictionary
Values()---Returns all the values in your dictionary
items()--- Returns all (Key, value) pair of your dictionary
update()---adds new keys and updates existing ones using another dictionary
pop()--- Removes a key form the dictionary and returns its value
popitem()---retuns and deletes the most recent key value pair from the dictionary
fromkey()--builds a new dictionary where all keys get the same default value
Comments
Post a Comment