📜  python do while - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:12.226000             🧑  作者: Mango

代码示例6
secret_word = "python"
counter = 0

while True:
    word = input("Enter the secret word: ").lower()
    counter = counter + 1
    if word == secret_word:
        break
    if word != secret_word and counter > 7: 
        break