+ 3

Multiple statements in enhanced if Python

All right. So, I am very new to Python and I am still trying to get used to it. I know that in Python I can have something like: verdict = "normal" if momAge > childAge else "impossible!" Now, my question is could I have multiple statements? I mean could I have something like this: verdict = "normal" life = "all is good" if momAge > childAge else "impossible!" "life makes no sense" If yes, what is the correct synthax? As I wrote it above it is not working. Thank you all in advance.

12th Mar 2018, 1:58 AM
cyk
cyk - avatar
1 Answer
+ 5
verdict, life = ("normal", "all is good") if momAge > childAge else ("impossible!", "life makes no sense")
12th Mar 2018, 2:24 AM
ChaoticDawg
ChaoticDawg - avatar