Learning Python 3

Hello World!! I am a computer science major and will be starting my first programming class in 3 weeks. The class focuses on Python and I believe we will be using Python 3. In the meantime I have started learning Python 3 on my own and I am developing a small program to help my classmates in calculus 1 next semester. Everything is going fine with the program so far but I was wondering if anyone had any advice on how to code a user name and password setup feature into a program. I have already set up a user name and password for the program but thus far it is only my username and password that I have written into the code.
Any help would be greatly appreciated.




  • ZachOZachO Wisconsin

    I am looking to do the same, so if you have any luck please let me know.

    This has been the most helpful code I've found so far.

    Sample log in screen (not usable yet)

    global status #status needs to be global for the while statement to function.
    # if it's not global you will be stuck in a login loop.

    users = {}
    status = ""

    def displayMenu():
    status = raw_input("Are you a registered user? y/n? Press q to quit:")
    if status == "y";
    elif status == "n":

    def newUser():
    createLogin = raw_input("Create login name:")

    if createLogin in users: # This checks to see if login already exists. 
        print "\nLogin name already exists!\n"
        createPassw = raw_input ("Create password: ")
        user[createLogin] = createPassw # add login and password
        print("\nUser Created!\n")

    def oldUser():
    login = raw_input("Enter login name: ")
    passw = raw_input("Enter password: ")

    #Need to check if user name and password match
    if passw = users[login]:
        print "\nLogin Successful"
        print "\nUser doesn't exist or wrong password\n"

    while status != "q":
    status = displayMenu()

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion