Skip to content

Instantly share code, notes, and snippets.

@mijorus
Last active May 3, 2022 10:01
Show Gist options
  • Save mijorus/f076fa05374fa7370e981332a7ce3443 to your computer and use it in GitHub Desktop.
Save mijorus/f076fa05374fa7370e981332a7ce3443 to your computer and use it in GitHub Desktop.
Ask the user to input a choice in the terminal, returns only if the answer matches a list of provided options
def ask(message: str, options: set) -> str:
_input = None
while not _input in options:
_input = input(message)
return _input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment