add value dictionary python code example
Example 1: how to add an element in dictionary
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["color"] = "red"
print(thisdict)
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#'