Python Forum
Making a Easy Password/code system - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Making a Easy Password/code system (/thread-4515.html)



Making a Easy Password/code system - nmsturcke - Aug-22-2017

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")



RE: Making a Easy Password/code system - sparkz_alot - Aug-22-2017

Did you drop some code in the posting process? I don't see where you are calling the passcode function.


RE: Making a Easy Password/code system - MasterGame - Jul-08-2018

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.


RE: Making a Easy Password/code system - Zombie_Programming - Jul-09-2018

I'm confused. You don't have any code posted where you call def passcode(enter).


RE: Making a Easy Password/code system - ichabod801 - Jul-09-2018

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.