set change order python 1

set change order python

>>> a = [1, 2, 20, 6, 210]
>>> b = set([6, 20, 1])
>>> [x for x in a if x not in b]
[2, 210]

Here is what the above code is Doing:
1. Create a list of numbers
2. Create a set of numbers
3. Create a new list of numbers that are in the first list but not in the second set

Similar Posts