I have a list inside a dictionary like so:
d = {first_name + last_name : [first_name, last_name, email, phone_number, birthday]}
What I am trying to do is update the first_name value inside the list and the key. For example, my dictionary may look something like this:
{'johndoe' : ['john', 'doe', 'jd@gmail.com', '911', '01/09']}
I want to be able to update the name to jane or whatever:
{'janedoe' : ['jane', 'doe', 'jd@gmail.com', '911', '01/09']}
What I am trying:
def update_first_name(d, first_name, last_name, new_field_value):
d[first_name + last_name][0] == new_field_value
return d
I have also tried using the update() method but I don't know how to use it to change a specific index of a value. I also believe I am running into issues because I am trying to change a variable that is in both the key and the value of the dictionary.
Any help would be greatly appreciated!