【发布时间】:2015-05-28 08:52:17
【问题描述】:
from datetime import datetime
platenumber = input("Enter the license plate number:")
start = input("Press enter to start.")
starttime =(datetime.now())
stop = input("Press enter to stop.")
stoptime =(datetime.now())
dist1 = 0
dist2 = input("Enter the distance of the road in metres:")
time = ((stoptime - starttime).total_seconds())
print((time),"is the time in seconds.")
distance = int(dist2) - dist1
print((distance),"is the the distance in metres.")
speed = float(distance)//time
print((speed),"is the speed of the vehicle in m/s.")
我想在使用后重新启动程序,以便可以多次检查车辆的速度。
请帮我完成代码,以便我可以自行重新启动代码并检查多辆车的速度。
【问题讨论】:
-
帮我编写可以帮助代码像连续循环一样在自身内部重新启动的代码
-
为什么不直接使用
while循环? -
“给我代码” - 不,做你自己的 GCSE 课程。
-
让程序反复重启本身几乎肯定是错误的方法。我建议学习循环。
标签: python python-2.7 python-3.x