Light Mode
Dark Mode
Issue with checking

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'])
Attachment
Attachment
Created: Feb. 19, 2019, 2:02 a.m.
Updated: Feb. 19, 2019, 5 a.m.
0
12
User avatar
Dmitrii_Kaluzhin