Last active
May 3, 2022 10:01
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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