using list comprehension with or code example

Example 1: python list comprehension

#example: removing common elements found in `a` from `b`.
a = [1,2,3,4,5]
b = [5,6,7,8,9]
# desired output: [1,2,3,4]

# gets each item found in `a` AND not in `b`
print([i for i in a if i not in b])

Example 2: list comprehension python

# Make a List that contains the doubled values of a given list:

values = [2, 4, 6, 8, 10]
doubled_values = [x*2 for x in values]
print(doubled_values) # Outputs [4, 8, 12, 16, 20]

# You could achieve the same result like this:

values = [2, 4, 6, 8, 10]
doubled_values = []
for x in values:
    doubled_values.append(x*2)
print(doubled_values)