hevolve = list() for mag, path, turnOff in zip(mags, paths, turnOffs): formater = {'A': 'ko', 'E': 'kx'} if turnOff[2] == 'A': dist = np.sqrt((turnOff[0]-turnOffs[0][0])**2 + (turnOff[1]-turnOffs[0][1])**2) hevolve.append((turnOff[3]-turnOffs[0][3], dist)) hevolve = np.array(hevolve)