I am writing a code which involves a login subroutine and the it works well apart from the fact that it gives two outputs when I only want one of them. The Subroutine is as follows:
def Login():
chances = 0
Status = True #Status refers to whether the person is logged in or not
while Status is True:
Supplied_Username = input('What is your username?')
Supplied_Password = input('What is your password?')
with open("Loginfile.txt","r") as Login_Finder:
for x in range(0,100):
for line in Login_Finder:
if (Supplied_Username + ',' + Supplied_Password) == line.strip():
print("You are logged in")
game()
else:
print("Sorry, this username or password does not exist please try again")
chances = chances + 1
if chances == 3:
print("----------------------------------------------------\n Wait 15 Seconds")
time.sleep(15)
Login()
sys.exit()
def game():
print('HI')
This works well like I said above. When the user inputs the correct details, they get both the:
'You are logged in' output and the 'Sorry... these details don't exist' output
What do I need to do to make sure I get the correct output for every scenario (wrong details and correct details)?