如何让它在 "b" 之后改变字符
How to make it change char after "b"
我正在尝试制作一个蛮力类型的程序,但它变得太多 "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 循环。我不确定
currPos = int(0) 不正确。用
替换循环更简单
for attempt in chars :
print(attempt)
我正在尝试制作一个蛮力类型的程序,但它变得太多 "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 循环。我不确定
currPos = int(0) 不正确。用
替换循环更简单for attempt in chars :
print(attempt)