In: Computer Science
PSUEDOCODE: Using whatever looping mechanism makes sense to you, create an algorithm that will display timing for a stopwatch.
Keep the following in mind:
Here the question isn't giving a exact description of what is needed but I'll assume we need to print the time in a stop watch and the user to stop it at anytime.
Now there are two thing we have to do,
Check if user has tried to close us and if the time is 24hrs so we can the hospital where as in any other situation we just need to increase value by 1/100 of a second.
import sys
HR=0
Min=0
milli=0
second = 0
while(true):
try: if(HR=23 and min==59 and Second ==59 and milli= 99):
Print( " calling the hospital")
elif(min==59 and second = 59 and Milli ==99):
HR +=1
min=0
second = 0
milli = 0
elif(second=59 and milli=99):
min+=1
second = 0
milli=0
elseif(Milli==99):
second+=1
milli=0
else:
milli+=1
print(Hr,":",minute,":",second,":",Milli)
except KeyboardInterrupt: sys.exit()
Go over the code this will work if every loop takes 1/100 of a second of a millisecond and as soon as something is pressed it or will call hospital on completion of 24 hrs
Hope it helps