如何突破多个for循环和if语句。当我使用break时,我想同时退出所有循环。谢谢

时间:2018-12-05 12:45:24

标签: python-3.x

使用break时,我试图完全摆脱循环并继续执行代码正文。

对于x范围为(26):

cipher = ''
decrypt(sentence, x)
list = cipher.lower().split()
for item in list:
    if item in words:
        print("This word was found: " + item, "\n")
        print(cipher, "\n")
        answer = input("Is this the correct message? \n")
        if answer == "yes":
            print("Encryption solved!")
            main()
            break
        elif answer == "no":
            continue
        else:
            break
    else:
        continue

0 个答案:

没有答案