DEV Community

Discussion on: How to emulate Ternary Operators of Javascript in Python.

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Why not just do this? 🤷‍♂️

result = a if condition else b
Enter fullscreen mode Exit fullscreen mode
Collapse
 
vanshcodes profile image
NoobCoder

Actually, I know this is better. But just wanted to show some python power to you