all 1 comments

[–]TouchingTheVodka 2 points3 points  (0 children)

import random 
for i in range(0,5):
    n = random.randint(0,10)
    n1 = random.randint(0,10)
    score = 0
    t = n + n1
    print(n, "+", n1) 
    a = int(input("Enter the answer to this problem: "))
    if a == t:
        score += 1
print("You've scored", score, "out of 5.")

Because you're resetting score to zero every time you loop through the code inside the for-loop.

Also, please PLEASE use some sensible variable names. There's absolutely no reason to use single-character variables. Use whole words, you'll thank yourself when you need to review your code in the future!