lets say I have a list:
A = ['x', 'y', 'z']
and another one - nested:
B = [['x', 'a', 'b', 'c'], ['y', 'c'], ['x', 'a', 'c', 'z']]
how can I remove 'z' from the last sublist in list B based on the knowledge that 'z' is in A and also every first element [0] of the sublist B is in list A ?
so basically i need to detele all elements from such a nested list where element is in A and where it not stands in the first position of that nested list ?
I am trying this but get stacked:
for i in B:
for j in i[1:]:
if j in A:
del j
but I am missing something.
i?