1>>> fruits = {}
2>>> key1 = input("Enter first key for fruits:")
3Enter first key for fruits:a
4>>> value1 = input("Enter first value for fruits:")
5Enter first value for fruits:apple
6>>> key2 = input("Enter second key for fruits:")
7Enter second key for fruits:b
8>>> value2 = input("Enter second value for fruits:")
9Enter second value for fruits:banana
10>>> fruits[key1] = value1
11>>> fruits
12{'a': 'apple'}
13>>> fruits[key2] = value2
14>>> fruits
15{'a': 'apple', 'b': 'banana'}
16>>># Same variable names for keys and values can be used if used inside a loop like this
17>>> fruits.clear()
18>>> fruits
19{}
20>>> for i in range(2):
21 key = input("Enter key for fruits:")
22 value = input("Enter value for fruits:")
23 fruits[key] = value
24
25Enter key for fruits:a
26Enter value for fruits:apple
27Enter key for fruits:b
28Enter value for fruits:banana
29>>> fruits
30{'a': 'apple', 'b': 'banana'}