Stellen Sie eine Frage zu Python
Question = input("your question")
if Question == ("yes")
print ("well done")
elif Question == ("no")
print ("try again")
Long Lion
Question = input("your question")
if Question == ("yes")
print ("well done")
elif Question == ("no")
print ("try again")
answer = input("Enter yes or no: ")
if answer == "yes":
# Do this.
elif answer == "no":
# Do that.
else:
print("Please enter yes or no.")
def question():
i = 0
while i < 2:
answer = input("Question? (yes or no)")
if any(answer.lower() == f for f in ["yes", 'y', '1', 'ye']):
print("Yes")
break
elif any(answer.lower() == f for f in ['no', 'n', '0']):
print("No")
break
else:
i += 1
if i < 2:
print('Please enter yes or no')
else:
print("Nothing done")
question()