import math import random score=0 num=eval(input("questions:")) questions=[] errors=[] for i in range(num): a=random.randint(2,9) b=random.randint(2,9) c=random.randint(2,9) op1=random.choice([' + ',' - ']) op2=random.choice([' + ',' * ',' - ',' * ']) exp= str(a) + op1 + str(b) + op2 + str(c) questions.append(exp) for i in range(num): exp=questions[i] d=eval(exp) ans=eval(input(str(i)+": "+exp+" : ")) if d == ans: score += 1 print("v") else: print("x") errors.append(i) print("1: score = ",score) for i in errors: exp=questions[i] d=eval(exp) ans=eval(input(str(i)+": "+exp+" : ")) if d == ans: score += 1 print("v") else: print("x") if len(errors)>0: print("2:score = ",score)