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
print(max_num(-10, 0, 10)) # first check, returns 0 (wrong)
print(max_num(-10, 5, -30)) # second check, returns 5 (right)
print(max_num(-5, -10, -10)) # third check, returns -5 (right)
I'm only something like 3 days into learning my first programming language (Python), and I was given a task to compare 3 numbers and return the largest. The 2nd and 3rd print checks are correct, as 5 and -5 are the largest out of their 3 numbers. However, the first check returns 0, which is obviously not the largest number, 10 is.