• Issue with checking

Question related to mission Compass, Map and Spyglass

 

Hi. Why does it work when I run the code but doesn't when I try to solve the task ??

import numpy as np

def dist(a,b):
    d=abs(np.array(a)-np.array(b))
    return sum(d)-min(d)

def navigation(seaside):
    a=np.array(seaside)
    v={x:y for y,x in np.ndenumerate(a) if x.isalpha()}
    return dist(v['Y'],v['C'])+dist(v['Y'],v['M'])+dist(v['Y'],v['S'])