So I'm making a math game where the user gets three tries to answer the problem and if not it shows the answer and goes to the next question however my code only lets they get it wrong once before going to the next problem. What am I doing wrong
nQuestions = 0
cAnswers = 0
attempts = 0
lvl = get_level()
while nQuestions != 10:
if attempts == 0:
x, y = generate_integer(lvl)
answer = x + y
sum = int(input(f"{x} + {y} = "))
if sum == answer:
cAnswers += 1
attempts = 0
nQuestions +=1
continue
else:
attempts += 1
if attempts == 3:
print(f"{x} + {y} = {answer}")
attempts = 0
nQuestions += 1
continue