I am trying to do a speed camera program by using a while loop to add up time. I want the user to be able to input "Enter" to stop the while loop with out the while loop pausing and waiting for the user input something, so the while loop works as a clock.
import time
timeTaken=float(0)
while True:
i = input #this is where the user either choses to input "Enter"
#or to let the loop continue
if not i:
break
time.sleep(0.01)
timeTaken=timeTaken+0.01
print(timeTaken)
I need a line of code which can detect whether the user has inputted something without using "input".