I know this is possible:
a, b = 5, 10
print 'a' if a > b else 'b' # outputs b
However, what if I had another variable 'c'? How do I make them print in the same line using the same type of logic as those two variables? Something like?
a, b, c = 5, 10, 20
print 'a' if a > b elif 'b' if b > c else 'c' # is it possible?
Aucun commentaire:
Enregistrer un commentaire