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:
4 ответов
+ 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?
+ 1
It depends on what you're trying to do. So far, I can see an infinite loop inside another...
0
Whoops, I forgot to say that this is a password finder.😬
0
And they are not infinite loops btw, they are set to conditions