I have two lists Visited_Indices
and Total_Indices
. I am generating a new list Not_Visited_Indices
such that it consists of elements which are not in Visited_Indices
. Is there an alternate way to do so instead of using [i for i in Total_Indices if not i in Visited_Indices]
as shown below? I present the current and expected output which are basically the same.
Visited_Indices= [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 6), (0, 7), (0, 8), (0, 10)]
Total_Indices = [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9), (0, 10)]
Not_Visited_Indices = [i for i in Total_Indices if not i in Visited_Indices]
print(Not_Visited_Indices)
The current and expected output is
[(0, 5), (0, 9)]