When I get stuck like this I find that it’s helpful to write things out so I can see what’s happening with the function logic.
So, the arguments passed through the function are (-10, 0, 10):
if (-10 > 0) and (-10 > 10):
Is -10 > 0? False AND is -10 >10? False
So, the first statement is False, and the return statement is not executed. The compiler goes to the
elif (num2 > num1) and (num2 > num3):
Is 0 > -10? YES, so, True AND 0> 10? NO, so, False. True AND False equates to…False.
and so on until the conditions are met and are True, which happens in the 2nd
elif (num3 > num1) and (num3 > num2):
is (10 > -10)? True AND is (10 > 0)? True…so, True and True evaluates to True, and
num3 is returned, so, 10.
Try passing through a bunch of different numbers to see how the logic works.
To understand more on Boolean logic, maybe google it to read up of George Boole too:
And, tbh, there are people on this forum that know way more than I do about how computers operate.