1default_data = {'item1': 1,
2 'item2': 2,
3 }
4
5default_data.update({'item3': 3})
6# or
7default_data['item3'] = 3
1# This automatically creates a new element where
2# Your key = key, The value you want to input = value
3dictionary_name[key] = value
1# Append to Dictionary in Python
2
3# Let's say we had the following dictionary:
4
5languages = {'#1': "Python", "#2": "Javascript", "#3": "HTML"}
6
7# There are two ways to add a key-and-value set to this dictionary
8
9# Number 1: By .update() method
10
11languages.update({"#4": "C#"}) # Adds a #4 key-and-value set
12
13#--------------------------------------------
14
15# Number 2: The define-key method
16
17# This is the easier one
18
19languages['#4'] = 'C#'
20
21# ^^ Just updates a key of #4 to C#, or adds it in this case
22
23