for循环:有理智,能提前知道循环会运行多少次
while循环:没头脑,能无限循环(奇异博士:“多玛姆,我来谈判了。”)
if循环:一根筋,只会循环一次
实操项目:
command = ""
while True:
command = input(">")
if command == "start":
print("THe card has been started")
elif command == "stop":
print("the car has been stopped")
elif command == "help":
print("""
start: make your car start
stop:make your car stop
quit: to exit
""")
elif command == "quit":
break
else:
print("sorry I don't understand")