I am trying to change the values of a list using list comprehension I can do that by using 3 list comprehensions
clr = [1,2,2,1,3,1,2,3]
clr= ["green" if i== 1 else i for i in clr]
clr = ["yellow" if i==2 else i for i in clr]
clr = ["black" if i == 3 else i for i in clr]
where as using the below mentioned code is throwing syntax error
clr = ["green" if i== 1 else "yellow" if i==2 else "black" if i == 3 for i in clr]
Is there any better way to do it??