Python Forum

Full Version: Making a Easy Password/code system
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I run this it only works when I enter in the input code which is the variable name not the string name can anyone help me please??

)

code = input("What's your passcode/word going to be?")

def passcode(enter):
    if code == enter:
        print("ACCESS GRANTED")
    else:
        print("ACCESS DENIED")
Did you drop some code in the posting process? I don't see where you are calling the passcode function.
I think you might want to add a backslash (\) here as following:
code = input("What\'s your passcode/word going to be?")
The backslash won't be printed and it'll avoid the code from breaking. I also think there is a spare parentheses on line 1.
I'm confused. You don't have any code posted where you call def passcode(enter).
What version are you running this in? If you run this in 2.7, input will try to evaluate any text it receives. If you run it in 3.0 or higher, input will just return the text without processing it.