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
this disclaimer
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.
135
136 Returns: True if 'Y' or False if 'f' was inputed; otherwise, returns
137 the raw user input (custom query).
138 '''
139
140 user_input = input('Did this solve your error? (Y/n or custom query): ')
141
142 if user_input not in ('Y', 'n'):
143 return user_input
144
145 if user_input == 'Y':
146 return True
147
148 return False
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets