Skip to content

62. Validating User input (Shortcut) #609

Open
@ManzarMaaz

Description

@ManzarMaaz

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions