我试图找到最少的数字,您可以输入尽可能多的数字,当您输入-1时,它会中断。寻找最小编号
a=int(input("What is your number of choice? "))
b=int(input("What is your number of choice? "))
c=int(input("What is your number of choice? "))
d=int(input("What is your number of choice? "))
smallest=a
if (b < smallest):
smallest=b
while(True):
smallest =int(input("What is your number of choice? "))
if (smallest == -1):
break
if (c < smallest):
smallest=c
while(True):
smallest =int(input("What is your number of choice? "))
if (smallest == -1):
break
if (d < smallest):
smallest=d
while(True):
smallest =int(input("What is your number of choice? "))
if (smallest == -1):
break
print(smallest, " is smallest of the numbers you chose")
我找不出如何解决它。
你没有使用'min'功能的原因? –
a' - '字符不是整数 – smoggers
如果对所有输入使用函数int(),如何在函数min中获得此异常? –