All code is at bottom of question
I wrote a function max_num(num1,num2,num3) which I expect to return the greatest value out of the 3 inputs, or return “It’s a tie!” if two or more of the values are equal. Instead of getting the suggested returns, I am getting the following:
It’s a Tie!
The only value that is returning incorrectly is -10; the other 3 values are correct. Can anyone please explain why this is happening? Thank you!
def max_num(num1,num2,num3): if num1 > (num2 and num3): return num1 elif num2 > (num1 and num3): return num2 elif num3 > (num1 and num2): return num3 else: return "It's a tie!" # Uncomment these function calls to test your max_num function: print(max_num(-10, 0, 10)) # should print 10 print(max_num(-10, 5, -30)) # should print 5 print(max_num(-5, -10, -10)) # should print -5 print(max_num(2, 3, 3)) # should print "It's a tie"