I was wondering, is it possible to put multiple if
conditions in a list comprehension? I didn't find anything like this in the docs.
I want to be able to do something like this
ar=[]
for i in range(1,n):
if i%4 == 0: ar.append('four')
elif i%6 == 0: ar.append('six')
else: ar.append(i)
using a list comprehension. How can I do it?
Is this even possible? If its not, what would be the most elegant (pythonic) way to accomplish this?