如何添加额外的字符? Python 3.X

时间:2015-01-28 19:24:00

标签: python python-3.x

所以我试图制作一个暴力类型的程序,原因.. 到目前为止,我已经使它工作..但只有一个角色,我真的不确定如何增加它检查" a"到" aa"," ab" " BA"等等 这是我到目前为止的代码

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"]

for attempt in chars :
    if(attempt == target):
        break
    else :
        print(attempt)   

print("Success! \""+ attempt + "\" was the correct password correct!")

更新

我的输出欲望是目标="密码" 而不是只循环直到它到达" 9"或者字符数组的结尾 当它到达" 9"它会做" aa" - " a9"然后重新开始" ba"到" b9"等等

0 个答案:

没有答案