【发布时间】:2015-12-10 19:17:34
【问题描述】:
print("Now please enter a number")
No1 = int(input(">> "))
有什么方法可以验证用户是否使用 while 循环和变量输入了一个数字,例如:
NumberInput1 = False
print("Now please enter a number")
while NumberInput = False
No1 = int(input(">> "))
#if a number was entered
NumberInput1 = True
#if a number wasn't entered
NumberInput1 = False
print("That is not a number try again")
【问题讨论】:
标签: validation python-3.x input