xxxxxxxxxx
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
even_or_odd = ['even' if num % 2 == 0 else 'odd' for num in numbers]
print(even_or_odd)
xxxxxxxxxx
>>> l = [1, 2, 3, 4, 5]
>>> ['yes' if v == 1 else 'no' if v == 2 else 'idle' for v in l]
['yes', 'no', 'idle', 'idle', 'idle']