0

Is there a shorthand way to do something like this (preferably all in one line)?

if something:
    var = "thing"
else:
    var = "other thing"
Ang_d
  • 19
  • 2

1 Answers1

0

This works

 a = 3 if True else 4

Sets a to 3 if first condition met (here True) else to 4

Lukas Nothhelfer
  • 728
  • 1
  • 5
  • 19