Skip to content

Instantly share code, notes, and snippets.

@MartinThoma
Created February 6, 2022 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinThoma/bc7294b25567e1bfd9ec2964447e03b3 to your computer and use it in GitHub Desktop.
Save MartinThoma/bc7294b25567e1bfd9ec2964447e03b3 to your computer and use it in GitHub Desktop.
from rich.prompt import Prompt, Confirm
is_correct = False
while not is_correct:
name = Prompt.ask("Enter your name", default="Martin")
is_correct = Confirm.ask(f"Is your name '{name}'?")
age = Prompt.ask(
"What is your age group",
choices=["<18", "18-25", "25-35", ">35"],
default="25-35"
)
print(f"You are {name} and your age is {age}.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment