Lambda including if…elif…else

Nest if .. elses:

lambda x: x*10 if x<2 else (x**2 if x<4 else x+10)

Leave a Comment