none
I need help with a login page in python RRS feed

  • Question

  • This is my code:

    It is saying this line

    createLogin = int(input("Create login name: "))

    Is not defined

    
    #start
    users = {}
    status = ""
    def displayMenu():
        status = input("Are you registered user? y/n? Press q to quit")
        if status == "y":
            oldUser()
        elif status == "n":
          newUser()
    def newUser():
      createLogin = int(input("Create login name: "))
    if createLogin in users:
        print("\nLogin name already exist!\n")
    else:
        createPassw = input("Create password: ")
    users[createLogin] = createPassw
    print("\nUser created\n")
    def oldUser():
      login = input("Enter login name: ")
    passw = input("Enter password: ")
    if login in users and users[login] == passw:
        print("\nLogin successful!\n")
    else:
      print("\nUser doesn't exist or wrong password!\n")
    while status != "q":
      displayMenu()

    Friday, June 23, 2017 3:01 AM

All replies

  • This is a C# forum, and it's also not a Web forum. I suggest you find forums based in the technology you are using.
    Friday, June 23, 2017 3:11 AM
  • Try ask your question here instead.

    EDIT: Since this question is not about web either (input() is a console function for Python), you should ask there either.

    See this SO answer. Basically input() will try to evaluate what you've entered. If you enter "y" there, it'll lookup and say "y" is not defined.

    If you don't want Python to evaluate the input string, you should use raw_input() instead.

    Alternatively, upgrade your Python to 3.X or above.
    • Edited by cheong00 Friday, June 23, 2017 4:13 AM
    Friday, June 23, 2017 4:02 AM