score = [10, 20, 30, 40, 50]
x = 2 
y = 4 

S = [0] * (len(score) + 1)
for i in range(len(score)):
    S[i + 1] = S[i] + score[i]

answer = S[y] - S[x - 1]

print(answer)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: