I am writing a function add_to_dict(d, key_value_pairs)
which adds each given key/value pair to the given dictionary. The argument key_value_pairs
will be a list of tuples in the form (key, value).
The function should return a list of all of the key/value pairs which have changed (with their original values).
def add_to_dict(d,key_value_pairs):
key_value_pairs=()
thelist=[]
thelist.append(list(d))
for key, value in key_value_pairs:
d[value]=key
thelist.append(list(key_value_pairs))
return thelist
What I got here seems completely not right and I have no clue at the moment.