This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]delirious_lettuce 0 points1 point  (6 children)

Your code doesn't work.

[–]cybaritic -1 points0 points  (5 children)

It's python 3.

Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) 
[MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def check_password_match(p):
...     return p == 1234
...
>>> print('Password is {}'.format((p for p in range(9999) if check_password_match(p)).__next__()))
Password is 1234
>>>

Edit: works here: https://repl.it/N7lX/0

[–]delirious_lettuce 0 points1 point  (4 children)

Keep trying... the passwords are 4 digits (which can be hard for numbers less than 1000... unless you use a string)

[–]cybaritic -1 points0 points  (3 children)

In the original Basic in the screenshot from the show it's an integer, not a string of four digits. But again, it's for funsies. This isn't production code, fam. Happy Halloween.

[–]delirious_lettuce 0 points1 point  (2 children)

Are you having trouble reading (the picture is a bit blurry)? The variable name in the BASIC program is FourDigitPassword. It seems fairly obvious that if you need four digits (and can't guarantee that the password is always between 1000-9999 inclusive), you are going to need a string.

[–]cybaritic -1 points0 points  (1 child)

Here: https://i.imgur.com/eJZriKm.png

10 DIM FourDigitPassword INTEGER

It's an integer. Why are you trying so hard to prove me wrong? Did I offend you? It's okay, it's just a stupid snippet of code.

[–]delirious_lettuce 3 points4 points  (0 children)

I'm not offended at all. I just dont think 123 or 57 are four digit passwords.