Question
Python 3 Implement a function getAns() that takes a string representing a question as a parameter and obtains and returns a yes or no answer
Python 3
Implement a function getAns() that takes a string representing a question as a parameter and obtains and returns a yes or no answer to the question from the user. The function should prompt the user with the question and indicate that the user must answer either yes or no to the question. If the user enters either yes or no (in any possible capitalization) the function returns an all lowercase version of the answer (e.g. either 'yes' or 'no'). If the user enters anything other than yes or no, the function repeatedly prompts the user for another answer. The following shows several sample executions of the function:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started