def main():
num1 = int(902)
num2 = int(100)
num3 = int(666)
if (num1 > num2) and (num1 > num3):
largest = num1
elif (num2 > num1) and (num2 > num3):
largest = num2
else:
largest = num3
print("The largest number is",largest)
main()
即使我的代码正确,我在Techgig Practice Test上的测试用例结果也显示失败,尽管我得到了正确的输出。在这种情况下,我应该一直解决这个问题。没有一个问题表明我通过了测试案例。
答案 0 :(得分:0)
尝试:-
def main():
num1 = int(input())
num2 = int(input())
num3 = int(input())
for x in (num1, num2, num3):
if x not in range(-100000, 100001):
print("Error! Numbers should be between -100000 and 100000.")
exit()
if (num1 > num2) and (num1 > num3):
largest = num1
elif (num2 > num1) and (num2 > num3):
largest = num2
else:
largest = num3
print(largest)
main()