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'])
Created at: 2019/02/19 02:02; Updated at: 2019/02/19 05:00