[Solved] Python Score Counter For Controlled Test [closed]


for counter in range(0, 5):
    while True:
        try:
            whohost = int(input("Who hosted the game? "))
            whowins = int(input("Who was the winner? "))
            if whohost in schoolnumber and whowins in schoolnumber:
                break
            else:
                raise ValueError()
        except ValueError:
            print('Please enter a valid number from the list {}'.format(schoolnumber)) 
    if whohost == whowins:
        homescores[whowins-1] += 2
    else:
        awayscores[whowins-1] += 3

This will loop over the two input statements until both the numbers entered are in schoolnumber. If a number not in the list or a string is entered it will display the error message and start over.

2

solved Python Score Counter For Controlled Test [closed]