有一个汽车,输入help(无论大小写),会弹出
start - to start the car stop - to stop the car quit - to exit输入start
Car started..Ready to go输入stop
Car stopped输入quit 会结束程序
输入其他
I don't understand that...有验证汽车是否启动,或者已经停止
init = ""
t = 0
while init != "quit":
init = input(">").lower()
if init != "start" and init != "stop" and init != "help":
print(" I don't understand that...")
elif init == "start":
if t:
print("car has started.")
else:
t = 1
print("Car started..Ready to go!")
elif init == "stop":
if t:
print("Car stopped.")
t = 0
else:
print("car has not started.")
else:
print(
"""start - to start the car
stop - to stop the car
quit - to exit"""
)

被折叠的 条评论
为什么被折叠?



