-1
print_list=input("Do you wish to print list \n:")
if print_list == "yes":
for item in List:
print (item , "%2.f" %(Speed),"m/s")
elif print_list == "no":
print ("Thank you")
if print_list != "yes" or "no":
while True:
print ("Invalid Input")
break
这是发生了什么事:循环当条件不符合程序
Do you wish to print list
:hhh
Invalid Input
Press "Enter Key" when the vehicle passes Sensor 1
:
我希望是该方案提出这样的问题:“你希望打印清单”,当用户输入无效。
'while true:'应该包围所有要重复的代码 –