之前,我曾就同一段代码问过类似的问题,但我再次发现自己陷于困境。特别是在生成包含两个字母,两个数字,然后两个字母的车牌时。我希望这个问题不会重复出现,但是在这种情况下,我非常想做什么,这是到目前为止的代码,希望您能确定我要去哪里:
from datetime import date, datetime, time, timedelta
import time, string
from random import uniform, random
def timeDelta():
print("Average Speed Checker")
start = (input("Car has passed Cam1: "))
licensePlate = str(firstLetters + randomNumber + " " + secondLetters)
print(licensePlate)
if start in ("y"):
camInput1 = datetime.now()
print(camInput1)
print("Car is travelling...")
time.sleep(1)
print("Car is travelling...")
time.sleep(1)
print("Car has passed cam2")
camInput2 = camInput1 + timedelta(seconds = uniform(5, 10))
timeDelta = camInput2 - camInput1
distance = 200
duration = timeDelta.total_seconds()
print("Time Delta …Run Code Online (Sandbox Code Playgroud)