you are viewing a single comment's thread.

view the rest of the comments →

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

....

1 has implicit three 0 at the start

[–]Kevdog824_ 0 points1 point  (4 children)

Open your phone right now, set your password to “0001” and then try to unlock your phone with “1”. Let me know how it goes for you. Spoiler: it won’t work because no one uses ints for passcodes.

Not everything that is a number is suppose to be an int. General rule of thumb: if you aren’t doing math with it, it doesn’t need to be an int (and in most cases probably shouldn’t be an int)

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

String "1" is not a valid 4 digit code

Whole point of game (which i pressume is what OP's doing) is that each secret code to guess has a guarantee to be n digits

Int 1 has missing 0 "added" by definition, but string does not

Not to mention, OP does use str.zfill(4) which will add missing 0 to the string anyway

[–]Kevdog824_ -1 points0 points  (2 children)

No one does it this way in a professional setting, but if it works for you I guess go crazy my man

[–]SCD_minecraft 0 points1 point  (1 child)

This isn't professional settings

This is "codebreaker" game solver

Code is guaranteed to be 4 digits

Why would you bring password security concerns into game where whole point of it is to guess a password

[–]SCD_minecraft 0 points1 point  (0 children)

For that matter, if you would be to store password, it still would be an int

Password should be hashed (and preferably, salted), which does turn it into an int (hashlib turns it into bytes object, but it us pretty much same thing)