Write a python program to merge two python dictionaries into one

dict1 = {“a” : 10, “b” : 20}
dict2 = {“x” : 30, “y” : 40}

dict = dict1.copy
dict.update(dict2)
Print(dict)

1 Like

@iqrarsheikh117

Correct , keep it up.

def merge(dict1, dict2):
return(dict2.update(dict1))

a= {‘name’ : ‘yash’, ‘age’: ‘21’}
b = {‘batch’: ‘Ds’, ‘score’: ‘88’}

print(merge(a,b))
print(b)

@Pyash3721

Correct , keep it up.