我试图制作一个暴力类型的程序,它也得到了#34; b"然后只是循环" b",我有点想知道什么是错的,但不是如何解决它 这是我目前的代码
target = input("What is the target word for you to get?\n")
chars = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "3", "4", "5", "6", "7", "8", "9"]
currPos = int()
attempt = chars[currPos]
nxt = currPos + 1
while(attempt != target):
print (attempt)
attempt = chars[nxt]
currPos += 1
currPos = int(0)
print("Success! \""+ attempt + "\" was the correct password correct!")
我知道我将不得不将while循环更改为for循环,甚至可能包含while循环。我不确定
答案 0 :(得分:1)
currPos = int(0)不正确。更简单的用
替换循环for attempt in chars :
print(attempt)