from datetime import datetime
time_enter = datetime.now()
print ("Has a car entered the section?")
if raw_input() == "yes":
print (datetime.now().strftime("%H:%M:%S.%f"))
datetime.now().strftime("%H:%M:%S.%f")
time_leave= datetime.now()
print ("Has a car leaved the section?")
if raw_input() == "yes":
print (datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
time_taken_to_travel = time_leave - time_enter
print (time_taken_to_travel)
else:
print ("No car has leaved!")
else:
print ("No car has entered!")
print ("No car has leaved!")
Hello, I have edited my code as said below, but it says that there is some kind of an error with the line 5, and the raw input. Can you help to correct it?
Has a car entered the section?
Traceback (most recent call last):
File "E:\code.py", line 5, in <module>
if raw_input() == "yes":
NameError: name 'raw_input' is not defined