list comprehension example
- by self
can we use elif in list comprehension?
example :
l = [1, 2, 3, 4, 5]
for values in l:
if values==1:
print 'yes'
elif values==2:
print 'no'
else:
print 'idle'
can we use list comprehension for such 2 if conditions and one else condition?
foe example answer like :
['yes', 'no', 'idle', 'idle', 'idle']
I have done till now only if else in list comprehension.