Trying to figure out why my code doesn’t work. It works great for the first 3 test calls but returns None for the tie. Here is the code:
def max_num(num1, num2, num3): if num1 > num2: if num1 > num3: return num1 if num2 > num1: if num2 > num3: return num2 if num3 > num1: if num3 > num2: return num3 else: return "It's a tie!"
It doesn’t look like it in the post, but the first test for each numx variable is indented 2 spaces with the following line indented another 2 spaces. The else is indented 2 spaces at the same level as the initial if.
I also changed the 2nd and 3rd ‘main’ ifs to elif. Doing that added another None return for the test call where num3 was the largest (1st test call)
I’m mostly wondering why my first attempt did not work for the tie.