@lernerpython.comReuven M. Lerner @lernerpython.com
2026-11-14 16:30 UTC
Want to restrict user input to a list of acceptable choices in your #Python program? Pass the "choices" kwarg to Rich's Prompt.ask: from rich.prompt import Prompt user_is_happy = Prompt.ask('Are you happy?', choices=['yes', 'no']) Bad input? The user has to try again.
1 picture (not shown on this phone)
2 likes, 0 reposts, 0 replies
3 Next post4 More from @lernerpython.comBackBluesky home