Page 8 - Lesson Note - DICTIONARIES
P. 8

update()
                 •  to merge two dictionaries
                 •  it merges the keys and values of one dictionary into another and overwrites values of
                   same key













               setdefault() method

               Inserts a new key:value pair into the dictionary only if the key doesn’t exist.
               If key exists, it returns the value of corresponding key.




















               copy()

               Returns a shallow copy of the dictionary. The shallow copy doesn’t modify the original
               string.
               Syntax:    dict.copy()
   3   4   5   6   7   8   9   10   11   12