Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

62. Validating User input (Shortcut) #609

Open
ManzarMaaz opened this issue Jun 24, 2024 · 0 comments
Open

62. Validating User input (Shortcut) #609

ManzarMaaz opened this issue Jun 24, 2024 · 0 comments

Comments

@ManzarMaaz
Copy link

def user_choice():
valid_range = range(0,11)
choice = 'ABCDE'

while choice.isdigit() == False or int(choice) not in valid_range:
    choice = (input('Please select a Number (1-10) :\n'))
    print(f"Let's Try, Select only from (1-10) : {choice}")

return(int(choice))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant