python dictoinary add value code example
Example 1: add value to dictionary python
dict[key] = value
Example 2: append dictionary python
>>> d1 = {1: 1, 2: 2}
>>> d2 = {2: 'ha!', 3: 3}
>>> d1.update(d2)
>>> d1
{1: 1, 2: 'ha!', 3: 3}
Example 3: Python dict add item
dictionary_name[key] = value
Example 4: python dictoinary add value
student_scores = {'Simon': 45 }
print(student_scores)
student_scores['Sara'] = 63
print(student_scores)
Example 5: append to dictionary python
languages = {'#1': "Python", "#2": "Javascript", "#3": "HTML"}
languages.update({"#4": "C#"})
languages['#4'] = 'C#'