energy = [5, 10, 15, 20, 25]
queries = [[0, 2], [1, 3]]
total = 0
answer = []

for i in queries:
    for j in range(i[0],i[1]+1):
        total += energy[j]
    answer.append(total)
    total = 0

print(answer)

Embed on website

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