Answers for "in python how to end the code after 10 input"

0

in python how to end the code after 10 input

incorrect = 0
max_tries = 3
choices = ['red', 'green', 'yellow']

while incorrect < max_tries:
    user_input = raw_input()
    if user_input not in choices:
        incorrect += 1
    else:
        rest_of_the_code(user_input)
        incorrect = 0

if incorrect == max_tries:
    sys.exit(1)
Posted by: Guest on April-02-2020

Code answers related to "in python how to end the code after 10 input"

Python Answers by Framework

Browse Popular Code Answers by Language