The sum of a range

Write code · Medium · §7.2, §7.3, §8.3 Handing over ingredients

Complete the function range_sum, which takes a list nums and two indexes, start and end. It returns the sum of the values from index start to index end (including end). The indexes are always valid positions in the list. Do not use sum().

Starter code

def range_sum(nums, start, end):
    # Write your code here
    pass

print(range_sum([1, 2, 3, 4, 5], 1, 3))

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.