1z = {**x, **y} #python 3.5 and above
2
3z = x | y #python 3.9+ ONLY
4
5def merge_two_dicts(x, y): # python 3.4 or lower
6 z = x.copy() # start with x's keys and values
7 z.update(y) # modifies z with y's keys and values & returns None
8 return z