How to use 'how to store user input in python' in Python

Every line of 'how to store user input in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
129def handle_user_input():
130 '''
131 Prompts the user to input whether or not his/her error was solved.
132 Valid inputs are 'Y' and 'n'. 'Y' meaning the error was solved and
133 'f' meaning it wasn't solved. Otherwise, whatever the user entered
134 is used for a custom query.
136 Returns: True if 'Y' or False if 'f' was inputed; otherwise, returns
137 the raw user input (custom query).
138 '''
140 user_input = input('Did this solve your error? (Y/n or custom query): ')
142 if user_input not in ('Y', 'n'):
143 return user_input
145 if user_input == 'Y':
146 return True
148 return False

Related snippets