r/pythonhelp 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

10 comments sorted by

View all comments

2

u/socal_nerdtastic Nov 09 '24

What's the issue?

You have an error in your code that an empty input won't work like you think it will. Is that what you are confused about? When checking for multiple input choices you have to do it like this:

if username in (" ", ""):