I making a quiz program using Python 3. I'm trying to implement checks so that if the user enters a string, the console won't spit out errors. The code I've put in doesn't work, and I'm not sure how to go about fixing it.
import random
import operator
operation=[
    (operator.add, "+"),
    (operator.mul, "*"),
    (operator.sub, "-")
    ]
num_of_q=10
score=0
name=input("What is your name? ")
class_num =input("Which class are you in? ")
print(name,", welcome to this maths test!")
for _ in range(num_of_q):
    num1=random.randint(0,10)
    num2=random.randint(1,10)
    op,symbol=random.choice(operation)
    print("What is",num1,symbol,num2,"?")
    if int(input()) == op(num1, num2):
        print("Correct")
        score += 1
        try:
            val = int(input())
        except ValueError:
            print("That's not a number!")
    else:
     print("Incorrect")
if num_of_q==10:
    print(name,"you got",score,"/",num_of_q)
 
     
    