I have been trying to create a program that asks for a username and password, and if the user gets it right exits the program, if they get it wrong asks again, and if they get it wrong again logs out of the system.
1: is this possible?
2: if it is, can anyone give me an idea on how to do this?
I have this so far: (i think it might work, but note that so far i haven't included the part where it logs out; i obviously don't know how, or if it is possible).
p = open("C:/Users/HoulahanB/Password.txt") u = open("C:/Users/HoulahanB/Username.txt") password_list = Password.readline() username_list = Username.readline() print password_list print username_list guessuser = raw_input("Enter the username: ") guesspass = raw_input("Enter the password: ") if guessuser in username_list: if guesspass in password_list: print "thank you for logging in", guessuser else: print "wrong password, program exiting" raw_input() exit()
Edited 5 Years Ago by The Bl: n/a