Unit 4
Unit 4
Functions, Tuples,
Dictionaries, Exceptions,
and Data Processing
By
M. Bhavani
M-Tech
UGC-NET qualified
Functions
You can also insert an item into a dictionary by using the update()
method, and remove the last element by using the popitem() method
Continued
5. You can use the for loop to loop through a dictionary,
6. If you want to loop through a dictionary's keys and values, you can use
the items() method
7. To check if a given key exists in a dictionary, you can use the in keyword
Continued
8. You can use the del keyword to remove a specific item, or delete a
dictionary. To remove all the dictionary's items, you need to use the
clear() method
copy_dictionary = pol_eng_dictionary.copy()