| 1 | initial version |
For every sublist of Yc and every element a in X, search a in the sublist and append the corresponding element b in Y (X and Y are aligned with zip):
Yc = []
for j in Xc:
l = []
for (a,b) in zip(X,Y):
if a in j:
l.append(b)
Yc.append(l)
Note that this way, the elements in the sublists are not sorted in the same order (but i guess you do not mind given the description).
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.