• Runs in stand-alone python but fails in checkio

I would like to give some feedback about ...

From: http://www.checkio.org/mission/text-hole-golf/solve/


Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0

The following solution runs under stand-alone Python 2.7, but fails in the checkio environment. printing h just before the return statement shows the right answer is being returned:

def golf(t): h=0 for u,v in [(i,j) for i in range(1,len(t)) for j in range(1,len(t[i])) if t[i][j]==' ']: try: h+=len([c for c in reduce(str.add,[t[w][v-1:v+2] for w in range(u-1,u+2)]) if 43