I hope this isn't a duplicate, I searched and could not find any answers. So I am curious how to make user input set to a key or value. A good example is a registering Username and Password program, You set the Key to Username and the value the password the user that just registered entered to that Username key. Ex: "ExampleName : Example Pass". Other questions said dict{input} but that only makes a key. how can a make a key for one input then make a value for that Key In another input? Thanks. For those who said this was a duplicate, this is different. The other answers to the other don't specify how to set specific inputs to values.
#Example
username_pass = {}
username_register = input("Register your username and create it.")
#Set this to a Key
password_register = input("What password do you want for this username?"
#Set this to the value for that key
create a dictionary
>>> dir_created = {}
>>> username = str(input('Enter username'))
>>> password = str(input('Enter password'))
>>> dir_created[username]=password
most important make a key as a string
Try this:
userDict = {}
userDict[username_register] = password_register
It is simple. After getting the username and password using input()
, just do
username_pass[username_register] = password_register
Or, to make this ridiculously easy:
>>> test = { input(): input() }
bob
password
>>> test
{'bob': 'password'}
error: selenium.common.exceptions.TimeoutException: Message:
jetpack compose not responding to keyboard input on emulator
Hexagon Grid CSS - All hexagons change size when each of them is clicked
How to render HTML pages as PNG/JPEG images with URL array using Javascript only?
Get count of items that matches a condition from mongo db in node js
“Duplicate entry” even though the column has UNIQUE constraint
When I run the code the first time it worksWhen I run it a second time, it can't find the csv file until I replace it
I'm new to Python and KivyNow, I am working on an application that uses python and I also use kivy for the interface
I'm connecting to a UNC path using win_unc:
With the following, I would like to control the EOL: