Answer:
Following are the code to this question:
def combine_guest(guest1, guest2):#defining a method combine_guest that accepts two dictionary
guest2.update (guest1)#use dictionary guest2 that use update method to update guest2 dictionary
return guest2#return guest2 dictionary values
Rory_guest= { "Ada":2, "Ben":3, "Dav":1, "Jo":3, "Charry":2, "Terry":1, "bob":4}#defining a dictionary and add value
Taylor_guest = { "Dav":4, "Nan":1, "bobert":2, "Ada":1, "Samantha":3, "Chr":5}#defining a dictionary and add value
print(combine_guest(Rory_guest,Taylor_guest))#calling the combine_guest method
Output:
{'Nan': 1, 'Samantha': 3, 'Ada': 2, 'bob': 4, 'Terry': 1, 'Jo': 3, 'Ben': 3, 'Dav': 1, 'Charry': 2, 'bobert': 2, 'Chr': 5}
Explanation:
In the code a method, "combine_guest" is defined, that accepts two dictionaries "guest1, guest2" inside the method, in which the "guest2" dictionary uses the update method to combine the value of the guest1 dictionary and use a return keyword to return guest2 values.
In the next step, two dictionaries are declared, that holds some values and use a print method to call the "combine_guest" method and prints its return values.