I m new to programming so I want to add the functions in my code to a class so can anyone edit it because I don t know how to use classes and I need an example

0 votes
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 = input("Create login name: ")
    if createLogin in users:
        print("Login name already exist!")
    else:
        createPassw = input("Create password: ")
        users[createLogin] = createPassw
        print("User created")

def oldUser():
    login = input("Enter login name: ")
    passw = input("Enter password: ")
    if login in users and users[login] == passw:
        print("Login successful!")
    else:
        print("User doesn't exist or wrong password!")

while status != "q":
    displayMenu()
Apr 30, 2021 in Python by anonymous

edited 4 days ago 15 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP