Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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]  
Comment

dictionary input from user in python3

d=dict(input().split() for x in range(n))
print(d)
Comment

python dictionary input

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)) 
Comment

PREVIOUS NEXT
Code Example
Python :: print specific key in dictionary python 
Python :: list remove method in python 
Python :: how to for loop in python stackoverflow 
Python :: delete content of table django 
Python :: phyton datetime comparison 
Python :: desktop notifier in python 
Python :: keep the user logged in even though user changes password django 
Python :: Python NumPy delete Function Syntax 
Python :: numpy diag() 
Python :: label binarizer 
Python :: how to generate python code 
Python :: django import could not be resolved 
Python :: clear many to many django 
Python :: attributes in python 
Python :: how to code a funtion in python 
Python :: python regeression line 
Python :: check if value in dictionary keys python dataframe 
Python :: how to convert str to int python 
Python :: how to count all files on linux 
Python :: how to add pagination in discord.py 
Python :: string slice python 
Python :: python web scraping 
Python :: loading bar 
Python :: how to find the last occurrence of a character in a string in python 
Python :: 3d data visualization python 
Python :: longest palindromic substring using dp 
Python :: color reverse 
Python :: python calculator 
Python :: Adding Elements to a Python Dictionary 
Python :: js choice function 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =