user input to a dictionary python code example
Example 1: how to take input for dictionary in python
for i in range(3):
data = input().split(' ')
d[data[0]] = int(data[1])
Example 2: user input dictionary python
# Creates key, value for dict based on user input
# Combine with loops to avoid manual repetition
class_list = dict()
data = input('Enter name & score separated by ":" ')
temp = data.split(':') class_list[temp[0]] = int(temp[1])
OR
key = input("Enter key")
value = input("Enter value")
class_list[key] = [value]