repl.it
@MaximTarna/

SeedCarResults

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
while True:
 timems=float(input("Enter car time - " )) # in miliseconds
 distance = 1 #distance between light sensors was 1m 
 timeS = timems/1000 #time in seconds (miliseconds / 1000)
 speedms= distance / timeS #speed = distance (m) divided by time (s)
 speedMPH = speedms * 2.23694 #convert from m/s to mph
 print("%.2f" % speedMPH ,"mph") #display speed to 2 decimal places