What is the syntax to update a dictionary?

<dictionary name>[<key>] = <new value for key>
#examples
passwords = {'John':1123421,'Shirley':'socks', 'Galen':4234.123}
passwords['Galen'] = 'socks'
print(passwords)

#output
{'John': 1123421, 'Shirley': 'socks', 'Galen': 'socks'}

 

Advertisements