r/PythonProjects2 • • Aug 15 '25

I'm currently developing a PIN Verification System as a Python beginner so I need some feedback to improve.

54 Upvotes

21 comments sorted by

View all comments

2

u/Hofi2010 Aug 16 '25 edited Aug 16 '25

Here a more pythonic version

employees_pin = {„Alice“: 1234, „Bob“: 5678, „Charlie“: 2025}
max_attempts, attempts = 3, 0

while attempts < max_attempts:
    name = input(„Enter your name: „)
    if name in employees_pin and employees_pin[name] == int(input(„Enter your PIN: „)):
        print(f“Access Granted. {name}“)
        break
    print(f“Access Denied. Attempts left: {max_attempts - attempts - 1}“)
    attempts += 1
else:
    print(„Too many failed attempts. Access blocked.“)

1

u/JamzTyson Aug 16 '25

employees_pin = {„Alice“: 1234, „Bob“: 5678, „Charlie“: 2025}

SyntaxError: invalid character '„' (U+201E)

(should be normal ascii single or double quotes)

1

u/Hofi2010 Aug 16 '25

Change to “ and it will work :). This editor changes characters

1

u/JamzTyson Aug 16 '25

The reddit editor is a pain when it comes to code.

If you switch to the Markdown Editor, you can enter code by adding 4 spaces before each line - characters such as quotes are not altered when using the Markdown Editor.