I want to write a function that gives returns 3 if x>y
returns 1 if x==0
and returns 0 if x<y
.
def make_points():
return lambda x,y: 3 if x>y else 0
I tried this but I want to add another condition.
returns 3 if
x>y
returns 1 ifx==0
and returns 0 ifx<y
You can basically write that as you described:
lambda x,y: 3 if x>y else 1 if x==0 else 0