I learned on the post How to write inline if statement for print? how to do inline if-else. Examples: Given assignment a=True
, it expected the output 42
for statement print(42 if a else 24)
and equivalent assignment x=42
on assignment x = (42 if a else 24)
.
Is there a way to use one further conditional statement i.e. 42 if a=='Hitchhicker' else if a=='Mountain-biker' 30 else 7
?