• why am I getting a different answer

I would like to give some feedback about ...

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


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

my code is:


def golf(h,j=0,k=0,r=[]):
    for i in range(len(h)):
        j,k,d=min([[x,y,((y-k)**2+(x-j)**2)**.5]for x,y in h],key=lambda a:a[2])
        h=[z for z in h if z!=(j,k)]
    return sum(r)


When I run this code in Python 3.4.1 Shell, I get the correct answer of 12.727922061357857, but when I run it in checkio, I get a Fail claiming that "Your result: 36.04163056034262".