Skip to content

Instantly share code, notes, and snippets.

@gh640
Created October 11, 2024 01:29
Show Gist options
  • Save gh640/b191067cef9dc9e88b568ed5ff4fca11 to your computer and use it in GitHub Desktop.
Save gh640/b191067cef9dc9e88b568ed5ff4fca11 to your computer and use it in GitHub Desktop.
Python: confirm
def confirm(message: str) -> bool:
answer = input(f"{message} [yes/No]: ").strip().lower()
return answer in ["y", "yes"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment