• Possible Bug

 

I would like to give some feedback about ...

From: http://www.checkio.org/mission/restricted-sum/solve/

HTTP_USER_AGENT:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36

I'm getting some bizarre behavior. Essentially, my sum fails the test for [2,2,2,2,2,2] != 12; however, I made my own assertion in order to test and it prints 12 right before passing the assertion, which the assertion can be seen below. To me it appears something is happening on your end which is altering the sum somehow. I am using a global variable, which I haven't used before in checkio.

---Here's my code---

mys = 0 def checkio(data): list(map(abu, data)) print(mys) return mys

def abu(num): global mys mys += num

if name == 'main': assert checkio([2,2,2,2,2,2]) == 12, 'testing'

---Here are the results---

Your result: 18 Right result: 12 Fail: checkio([2,2,2,2,2,2])