Finding maximum number:
my_max=lambda a,b,c:a if a>b and a>c else(b if b>c else c)
print(my_max(4,7,6))
Output:
7
Finding minimum number:
my_min=lambda a,b,c:a if a<b and a<c else(b if b<c else c)
print(my_min(4,7,6))
Output:
4
my_max=lambda a,b,c:a if a>b and a>c else(b if b>c else c)
print(my_max(4,7,6))
Output:
7
Finding minimum number:
my_min=lambda a,b,c:a if a<b and a<c else(b if b<c else c)
print(my_min(4,7,6))
Output:
4
No comments:
Post a Comment