# 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]
family = {}
num = int(input("How many elements?: "))
for i in range(num):
k = input("Enter key: ")
v = input("Enter value: ")
family.update({k:v})
print(family)
family = {}
family["Name"] = input("Enter name: ")
family["Age"] = int(input("Enter age: "))
family["Relation"] = input("Enter relation: ")
print(family)
d=dict(input().split() for x in range(n))
print(d)
class_list = dict() data = input('Enter name & score separated by ":" ') temp = data.split(':') class_list[temp[0]] = int(temp[1]) # Displaying the dictionary for key, value in class_list.items(): print('Name: {}, Score: {}'.format(key, value))