I'm trying to assign a color to items from list if they are contained in another list. So far I'm using a list comprehension, and I get an error when I try to assign the color to those items which are not in a_list.
a_list = ['a', 'b', 'c', 'd', 'e', 'f']
b_list = ['b', 'f']
color = ['blue' for x in a_list if x in b_list else 'black']
ERROR MESSAGE:
File "<ipython-input-53-90957eb35bbb>", line 4
color=['blue' for x in a_list if x in b_list else 'black']
^
SyntaxError: invalid syntax