I'm trying to make the code repeat the line "player name invalid" and ask for the input repetively until the input is "player 1". How do i do that?
correct_n="player 1"
while True:
Name1 = input ("Enter Your Name: ")
if Name1 == correct_n:
cp = 'password'
while True:
password= input("enter the password ")
if password == cp:
print ("yes you are in")
break
print("please try again")
else:
print("Player name not valid")
break
print("player name invalid")
The code just prints "player name invalid" and goes on to do the rest of the code. I don't want the rest of the code to be outputted until the user inputs the correct name and password.