In python 2.6, I want to do:
f = lambda x: if x==2 print x else raise Exception() f(2) #should print \"2\" f(3) #should throw an exception <
the solution for the given scenerio is:
f = lambda x : x if x == 2 else print("number is not 2") f(30) # number is not 2 f(2) #2