6. Copy and add to a Dictionary
Compose a function, copy_and_add, that satisfies the following:
The function copy_and_add takes a dictionary as an argument copies all the key/value pairs to a result dictionary.
If the dictionary includes the key 'name', the associated value of that key is updated to 'John'.
If the dictionary does not include the key 'name', then that key must be added with a value of 'Alice'
Args: dictionary is a dictionary.
Returns: the resulting dictionary with the updated value for the key 'name'.
Drag from here
Construct your solution here, including indents
def copy_and_add(dictionary):
result = {}
for key in dictionary:
result[key] = result ['name']
if "name" in result:
result['name'] = "John"
else:
result["name"] = "Alice"
return result