dict python add key value code example
Example 1: add new keys to a dictionary python
d = {'key':'value'}
print(d)
d['mynewkey'] = 'mynewvalue'
print(d)
Example 2: add value to dictionary python
dict[key] = value
Example 3: python dictoinary add value
student_scores = {'Simon': 45 }
print(student_scores)
student_scores['Sara'] = 63
print(student_scores)
Example 4: append to dictionary python
languages = {'#1': "Python", "#2": "Javascript", "#3": "HTML"}
languages.update({"#4": "C#"})
languages['#4'] = 'C#'