-1

users = {} status = ""

def Menu(): global status status = input("Are you a registered user Y/N? Enter q to quit. \n")

if status == "Y" or "y":  #I wanted to make the option do capital and lowercase Y and N but when I
    OldUser()
elif status == "N" or "n":  #enter "n" it goes to OldUser() instead of Register()
    Register()

def Register(): name = input("Enter a username: ")

if name in users:
    print("The username is already used. Try again.")
else:
    pass_w = input("Enter a password: ")
    users[name] = pass_w
    print("\n Registration Complete! \n")

def OldUser(): login_n = input("Enter your username: ")

if login_n in users:
    login_p = input("Enter your password: ")

    if login_p == users[login_n]:
        print("\n Login Successful! \n")
    else:
        print("Password incorrect!")
else:
    print("\n Wrong user or user doesn't exist. \n")

while status != "q": Menu()

KritZ
  • 3
  • 1
  • additionally you can add a .lower() or .upper() to the end of your variable so userInput = input('Enter y or n').lower() and then your if statement just use lowercase y and even if they use and uppercase letter itll convert it too a lowercase – SpacedOutKID Aug 14 '20 at 22:31

2 Answers2

1

You need to do it like this:

if status == "Y" or status == "y": 
    OldUser()
elif status == "N" or status == "n":  
    Register()

And their is another better solution to do it like this:

if status.lower() == "y": 
    OldUser()
elif status.lower() == "n":  
    Register()
JaniniRami
  • 493
  • 3
  • 11
0
if status in ["Y", "y"]:  
    OldUser()
elif status in ["N", "n"]:  
    Register()

or you can use

if status  == "Y" or  status  == "y":  
    OldUser()
elif status ==  "N" or  status  =="n":  
    Register()

or you can lower status and do this

if status.lower() ==  "y":  
    OldUser()
elif status.lower() ==  "n":  
    Register()
abdulsaboor
  • 678
  • 5
  • 10