choice = "" while choice != "Да" or "Нет": choice = input("Могу предложить подсказку(введите Да или Нет): ") if choice == "Да": points = 5 

The problem is that the cycle is endless. Do not really understand why?

    2 answers 2

    The condition of your cycle is equivalent to (choice != "Да") or "Нет" . This condition is always true (if the condition in brackets is false, then "No" is interpreted as true, because it is a non-empty string), so the loop is infinite.

    You need a condition of choice != "Да" and choice != "Нет" or choice not in {"Да", "Нет"} .

    • one
      Perhaps you meant choice not in ("Да", "Нет") brackets (tuple) or at worst square (list)? - VisioN
    • @VisionN, I meant set, and these are braces. - insolor
    • And, this is a new syntax from 2.7 / 3. Did not know :) - VisioN

    Firstly, the condition of the cycle is not written correctly. And it is not clear: if the choice is "No", then what?

     choice = "" while choice != "Да" or choice != "Нет": choice = input("Могу предложить подсказку(введите Да или Нет): ") if choice == "Да": print("points = 5") points = 5 elif choice == "Нет": print("Выходим из цикла, не взяв подсказку!")