def get_answer(message, answers='<STR_LIT>', default='<STR_LIT:Y>', quit='<STR_LIT>'):
if quit and quit not in answers:<EOL><INDENT>answers = answers + quit<EOL><DEDENT>message = message + '<STR_LIT:(>' + '<STR_LIT:/>'.join(answers) + '<STR_LIT>' + default + '<STR_LIT>'<EOL>ans = input(message).strip().upper()<EOL>if default and not ans:<EOL><INDENT>ans = default.upper()<EOL><DEDENT>while ans not in answers.upper():<EOL><INDENT>ans = input(message).strip().upper()<EOL><DEDENT>if quit and ans == quit.upper():<EOL><INDENT>print("<STR_LIT>")<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>return ans<EOL>
Get an answer from stdin, the answers should be 'Y/n' etc.
If you don't want the user can quit in the loop, then quit should be None.