Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to get dictionary input from user in python

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)
Source by www.quora.com #
 
PREVIOUS NEXT
Tagged: #dictionary #input #user #python
ADD COMMENT
Topic
Name
7+6 =