r/learnpython • • Sep 06 '26

Password guesser game help needed

Hello guys. So I have created a password guesser game with direct comparison (i.e. if guess == correct_password:) but I want to use different methods for comparison. What techniques can I use? Here is the code-

```python

password = "Random_pass_123"

tries = 0

while tries < 3:

guess = input("Enter the password: ")

if guess == password:

print("Admin access granted.")

break

else:

print("Invalid credentials entered. Please try again")

tries += 1

if tries == 3:

print("Number of tries exceeded. Access denied")

```

PS- Is this the right way to paste code? I'm new so I'm not sure.

6 Upvotes

31 comments sorted by

View all comments

Show parent comment

1

u/Expensive-Bear-1376 Sep 07 '26

Ok, trying on old reddit with four spaces (and Chrome on Pixel).

Typing:

def test():
    pass

Pasting:

def test():
    pass

2

u/Bright_Mix_773 Sep 07 '26

Confirmed from the raw: both blocks are 32,32,32,32 the whole way down, the typed one and the pasted one. Not a single nbsp left, and both render as real blocks.

So it was the composer all along - not the keyboard, not the Pixel, not an extension. And old reddit's textarea is the way out on that device.

Thanks for running it. That was the test that settled it.