0

I'm trying to make a simple program that prompts for a password and then continues to a different section of the program, else loops back to the original prompt for the password.

I can't find a way to do this other than to use external things - such as text documents and buttons - and I don't need the password to be encoded. I just want it to show up right away without adding text files or buttons.

Such as:

Enter password: "hi"

if the password is "hi" it continues on

if the password is anything else it loops back to

Enter Password:

Can this be done? Ideas?

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Cayris
0

You would use a while() loop or function for this, Search the web for either as there are many examples of password entry. Some pseudo-code

def get_pw():
    while 1:
        pw=raw_input()
        if pw is correct:
            return
0

A while loop ended up being what saved me mounds of frustration. I simplified it with:

while password != "hello":
    password = raw_input("Please Enter Password: ")
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.