Python Forum
Making a Easy Password/code system
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a Easy Password/code system
#1
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")
Reply
#2
Did you drop some code in the posting process? I don't see where you are calling the passcode function.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
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.
Reply
#4
I'm confused. You don't have any code posted where you call def passcode(enter).
Reply
#5
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.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Code problem - probably easy fix? colin_dent 5 879 Jun-30-2023, 01:55 PM
Last Post: deanhystad
  how to make bot that sends instagram auto password reset code kraixx 2 1,366 Mar-04-2023, 09:59 PM
Last Post: jefsummers
  Avoid third party functions to wrote my python code into system debug-log? mark 9 2,197 Apr-09-2022, 08:41 PM
Last Post: mark
Star I was making code for collision for my character izmamonke 2 2,080 Aug-06-2021, 04:30 PM
Last Post: izmamonke
  Making a code.py file to function, does not run hobbyist 6 2,889 Jan-27-2021, 07:50 AM
Last Post: DeaD_EyE
  Making new lines of code AvioxyYT 1 1,801 Jan-22-2021, 07:02 PM
Last Post: buran
  Difference between os.system("clear") and os.system("cls") chmsrohit 7 16,614 Jan-11-2021, 06:30 PM
Last Post: ykumar34
  Problem with very easy code. janekk9002 1 1,797 Dec-10-2020, 12:57 PM
Last Post: buran
Question Difference between Python's os.system and Perl's system command Agile741 13 6,805 Dec-02-2019, 04:41 PM
Last Post: Agile741
  What was my mistake in this Python code (easy)? voltman 4 3,441 Nov-19-2019, 09:58 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020