does this look right so far? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

does this look right so far?

Im not finished yet, but i want to know if im on the right track import string passw='3wsq1657' guess='' while guess!=passw: for guess in range(6, 9): letter = 0 digit = 0 cha = 0 x = string(ascii_letters) z = string(ascii_digits) while guess!=passw: if passw[cha] in ascii_letters: while guess[cha]!=passw[cha]: if x[letter]!=passw[cha]: letter = letter + 1 elif x[letter]==passw[cha] elif passw[cha] in ascii_digits:

15th Oct 2018, 3:35 AM
Hayden
4 Answers
+ 2
You're using the variable 'guess' for different purposes in the same scope. First it is a string, then you use it to iterate over the range(6, 9). After that, guess will be 8 and will never be equal to passw, so yes, it is an infinite loop because the break condition will never be met. You can't access the nth element of an integer with guess[n]. What's going on in the last two lines? Where is the rest of the code?
15th Oct 2018, 4:56 AM
Anna
Anna - avatar
+ 1
It depends on what you're trying to do. So far, I can see an infinite loop inside another...
15th Oct 2018, 3:48 AM
Emerson Prado
Emerson Prado - avatar
0
Whoops, I forgot to say that this is a password finder.😬
15th Oct 2018, 4:50 AM
Hayden
0
And they are not infinite loops btw, they are set to conditions
15th Oct 2018, 4:51 AM
Hayden