inline-if

Python lambda with if but without else

Python lambda with if but without else Question: I was writing some lambda functions and couldn’t figure this out. Is there a way to have something like lambda x: x if (x<3) in python? As lambda a,b: a if (a > b) else b works ok. So far lambda x: x < 3 and x …

Total answers: 5