Ceaser Cipher-Python,嵌套循环


word = ((raw_input("please enter the letters  ")).upper())
word = word.replace(" ","")
word.decode('utf-8', 'ignore')
wordlist = list(word.strip())
numberlist = []
newlist = []
num = 0
while num <= 13:
    for i in wordlist:    #conversion from letters to numbers
        numberlist.append(ord(i))
    for i in numberlist:    #bigger than Z check
        numberlist[numberlist.index(i)] = i + num+1
        if i >= 90:
            numberlist[numberlist.index(i)] = (i - 90) + 65
    for i in numberlist :
        newlist.append(chr(i))
    print ''.join(newlist)
    num += 1
    del newlist[:]
    del numberlist[:]

我在"for i in list:"循环上分支循环时遇到问题

我看错了两件事。

未定义"列表"变量。

"for i in list:"如果它不在您的程序中,则不会运行。

相关内容

  • 没有找到相关文章

最新更新