Have a little problem with a simple function that need solving
would like to be able to edit a dict
with the update()
but the problem is that I want to update it using its value and not its key
here is my code:
contacts = {"Mohamed": {"name": "Mohamed Sayed", "number": "0123565665", "birthday": "24.11.1990", "address": "Ginnheim 60487"},
"Ahmed": {"name": "Ahmed Sayed", "number": "0123456789", "birthday": "06.06.1990", "address": "India"}}
def edit_contact():
user_input = input("Please enter the name of the contact you want to edit: ")
for k in contacts:
if user_input == contacts["Mohamed"]["name"]:
print(contacts)
Mohamed
, or the innername
valueMohamed Sayed
?