lundi 16 novembre 2015

i am working on my coursework and i dont know how to do a format check on it

i am working on my coursework at the moment and I am finding it hard to do a format check on the number plates. this is my code so far

f = open("JAMES1.TXT","r")
lines = f.readlines()
for line in lines:
    numberplates = line[0:7]   
    start_time = int(line[9:13])
    end_time = int(line[14:18])
    time = (end_time - start_time)
    time2= (time/60)
    distance_camera = int(40)
    speed = distance_camera/time2
    if speed > 30: 
        print("these number plates have been execeding the speed limit",numberplates,speed,"mph")        
f.close()




Aucun commentaire:

Enregistrer un commentaire