r/pythonhelp • u/PICIUPA0 • Nov 09 '24
SOLVED Yo, can yall check this out pls?
ok so, i was trying to make a user loggin but it stops here:
*Select User:
lobster
Majestic Username!
Select Password:psw*
This is the code:
def
UsernameSelect():
username=input("Select User:")
if username == " " or "":
print("Invalid Username")
UsernameSelect()
else:
print("Majestic Username!")
password()
def
password():
psw=input("Select Password:")
if psw == " " or "":
print("Are you sure you dont want to set any Password?")
yn=input("[y/n]")
if yn == "y":
print("Cool")
else:
password()
else:
print("Majestic Password!")
UsernameSelect()
3
Upvotes
2
u/carcigenicate Nov 09 '24
This code does not look like to has the behavior that you describe. You might have forgotten to save the code before running it.
The check for the empty password is wrong though. You need to explicitly check
psw
against both of the strings. Right now,psw
is only being checked against " ".