Is there any way to give user time to take the action, if he doesn't, program ommits the function? I have written a program with "duration" that you know what I mean.
I want the stopwatch to act like they usually do - I want it to display how time is changing and at the end it should output how many seconds has passed
for example: In that way the stopwatch should behave when we turn it off at 5.34 second:
1
2
3
4
5
5.34
def stopwatch_2():
start = time.time()
stop= ''
print("click something to stop the watch")
time.sleep(0.9)
clock_1=0
clock_2=0
while(stop==''):
clock_1=round(time.time()-start,0)
if (clock_1 > clock_2):
print(clock_1)
clock_2=clock_1
*this moment:*
else:
during(1 sek):
stop = input()
print(round(time.time()-start,2))