0
returning from function
def max(x, y): if x >=y: return x else: return y print(max(4, 7)) z = max(8, 5) print(z) let me know the explanation of this coding
1 Answer
+ 3
you defined a function named max which returns the first element if that is greater or equal and second element if that is greater.
at first, you called the function fir 4 and 7. as 7 is greater, the output is 7
And then, you called the function for 8 and 5 in the z variable. As 8 is greater than 5, 8 is stored in z. Then you printed z which is 8.