• Feedback from user professorlamp

 
Hi there,

For some reason my answer is coming back as incorrect in your environment but the answer is correct in every other program I've used to solve this problem. I'm talking about the 'restricted sum' problem. 

It answers the 1st test correctly but the 2nd test [2,2,2,2,2,2] returns 18 for an unknown reason. I have tested this on the Python IDE, ideone.com and repl-it.com and they all produce 12 but yours says 18.

Here is my code

total = 0

def checkio(data):
    global total
    print(data)
    if data:
        total += data.pop()
        checkio(data)

    return total