dictionary input from user in python3

Solutions on MaxInterview for dictionary input from user in python3 by the best coders in the world

showing results for - "dictionary input from user in python3"
Jonah
12 Jul 2020
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'}
Moritz
12 Oct 2018
1d=dict(input().split() for x in range(n))
2print(d)
queries leading to this page
how to give input of key in dictionary pythondictionary input from user in python3create a dictionary that take input from user in pythonhow to input key and values to empty dictionary in pythonexplain what output 3d 7b 2a 2ainput 7d does in python where input is a dict how to take input dictionary in pythonhow to get dictionary input from user in pythonhow to take input as dictionary in pythontake user input dictionary in pythonpython take dictionary inputhow to take input from user in dictionarytake dictionary as input pythonuser input in dictionary in python3get dictionary input in pythondictionary input pythonhow to use dictionary with user input in pythontake input as dictionary in pythonhow to take input in dictionary in pythoninput dictionary pythonhow to read from a dictionary in python with user inputhow to take dictionary as input in pythonpython taking input in a dictonaryinput data into dictionary pythontake input for dictionary in pythontake dictionary as user inputaccessing elements from python dictionary by user inputhow to add input value in dictionary pythonuser input dictionary pythonhow to get input from a user in python dictionaryinput new value to dictionary pythonwrite a program to create dictionary using input in pythoncheck dictionary emptyhow to access dictionary key based on user input pythonpython dictionary show keys and values with inputpython input a dictionaryuser input dictionarycreate dictionary python from user inputpython dictionary with inputdictionary input from userhow to take input for dictionary in pythonhow to take a dictionary as input in pythonhow to take input of dictionary in pythoninput into dictionary pythoncreate dictionary with input pythonpython dictionary take input from userhow to creat a diction with inputpython enter input as dictionary valueshow to create a dictionary bu adding inputs in pythontake input and store it in a dictonary python how to take user input for dictionary in pythondictionary user input pythonhow to input to a dictionary pythoninput values in dictionariespython dictionary methods and user inputhow to take dictionary input in pythoncreating and input dictionaryinit key value dictionnarytaking input in python dictionarypython enter output as dictionary vlauesdictionary input in pythonadd input to dictionary pythoncreate dictionary and take input from user in pythondictionary user input in pythondictionary python inputdictionary input from user in pythontake user input in python dictionaryhow a dictionary as a user input in pythonhow to take user input in dictionary in pythonnumber dictionary with input pythonuser input dictionary in pythonhow to take input from user in dictionary in pythonhow to take input from user as dictionaryinput data into a dictionary and print the dictionary in pythontaking dictionary input in pythonhow to get dictionary inputhow to input dictionary in python from userhow to create dictionary in python by user inputdictionary call based on user input pythondictionary input from user in python3