0
How I use dictonaries to basic login ?
I try but ı can not combine passwords and usernames.I need elementary code..
4 Answers
+ 6
Check my answer again, I updated it with a link to a code
+ 6
It's a key:value structure, so you have to go with something like this:
users = {'jack44': 's3jx5', 'jill33': 'gsk4!', 'mary.lou': 'mama99'}
login = input('Enter your login: ')
pwd = input('Enter your password: ')
if login in users:
if users[login] == pwd:
print('Welcome', login)
else:
print('Wrong credentials. The police is on its way đ')
else:
print('Sorry, no such user exists.')
https://code.sololearn.com/cL6i8GOXOVRw/?ref=app
0
thank you bro you re awesomee <3 :)))
0
ı did your codes but ı take str error.why ??