- This code is supposed to find the biggest number.
- When I plug in (200, 4, 100) in order, it says that 4 is the biggest number.
- When I plug in numbers of similar size, it has no problem.
- I feel like this is due to my lack of looping knowledge.
- Can someone teach me what's the issue? (student still learning)
def num_max(num1, num2, num3):
if num1 >= num2 and num1 >= num3:
return(num1)
elif num2 >= num1 and num2 >= num3:
return(num2)
else:
return(num3)
while 1:
num1 = input("#1: ")
try:
in1 = int(num1)
break
except:
print("Invalid: Try again")
while 1:
num2 = input("#2: ")
try:
in2 = int(num2)
break
except:
print("Invalid: Try again")
while 1:
num3 = input("#3: ")
try:
in3 = int(num3)
break
except:
print("Invalid: Try again")
print("The biggest number you entered is the following: ")
print(num_max(num1, num2, num3))