Letter only six digit password cracker
jort57 (4)

pretty cool. its not the best since i use random letters but yea. dont use this to hack people cuz hacking is bad

You are viewing a single comment. View All
RohanRajagopal (1)

This is very good, but it has an error, and besides fixing that, there are also other things that need improvement:

  • The guess7 code is unnecescary and creates the error, as the password are only 6 characters
  • You don't really need to be working with lists here, you can do indices and loop over and len() and stuff with strings, too
  • If you really need to convert a string to a list, just do list(my_string), so for example, `list("abcde") would return ["a","b","c","d","e"]
  • You don't need to do something[random.randrange(...)], there is a random.choice function for that, random.choice(something)
  • The switch variable is never anything other than True so you can get rid of it and make all your loops while True:
  • The entire guessing code could be shortened greatly with a nested loop, for example:
successful_guesses = []
for letter in user_password:
    while True:
        guess = random.choice(letters)
        if guess == letter:


  • user_password can now be any length
  • Code is shorter
  • You can get rid of split and, and switch, and all of that
  • You should be able to expand letters to more possibilities.

Here are some extra things you could do:

  • Print how long it takes for python to guess your password (use time)
  • Suggest a better password to the user

But this is a very cool code.

EDIT: corrected spelling of "successful"

jort57 (4)

@RohanRajagopal holy moly i havent got this kind of reply before. thank you! im not the best at python and this project was kind of shaky and just not very good. i appreciate the feedback! :)

RohanRajagopal (1)

@jort57 Thank you! Glad to be of help.