Yes:
x=3 if a=='yes' else 7
This assigns 3 or 7 to x depending on the value of a.
Curt B.
asked 05/16/18
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.