Thursday, November 5, 2009

A simple Login with Dictionary (Python)

Just a Simple login that uses Dictionary. Don't know if it work on a console. Plus i can't figure out a way to add something to the dictionary while the program is running.

database={'username': '1234', 'username2': '5678', 'username3': '9012'}
name = raw_input('Enter username: ')
ask = raw_input('Enter pin: ')
if ask in database[name]:
print 'Welcome', name
else:
print 'Invalid code'
you can try it's
Neoriz

2 comments: