answer only if you know the answer and I want python program code
Attachments:
Answers
Answered by
1
Answer:
Explanation:
n its simplest form you just ask the question, get the answer and process the answer, i.e.:
answer = input("Enter yes or no: ")
if answer == "yes":
# Do this.
elif answer == "no":
# Do that.
else:
print("Please enter yes or no.")
You can go further and loop the question to allow for repeated incorrect input:
answer = None
while answer not in ("yes", "no"):
answer = input("Enter yes or no: ")
if answer == "yes":
# Do this.
elif answer == "no":
# Do that.
else:
print("Please enter yes or no.")
Similar questions
Math,
5 months ago
Computer Science,
5 months ago
Economy,
5 months ago
Physics,
10 months ago
Math,
10 months ago