At Westonci.ca, we connect you with the best answers from a community of experienced and knowledgeable individuals. Discover the answers you need from a community of experts ready to help you with their knowledge and experience in various fields. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.
Sagot :
Answer:
In Python:
hh = int(input("Hour: ")) * 3600
mm = int(input("Minutes: ")) * 60
ss = int(input("Seconds: "))
seconds = int(input("Additional Seconds: "))
time = hh+ mm + ss + seconds
hh = int(time/3600)
time = time - hh * 3600
mm = int(time/60)
ss = time - mm * 60
while(hh>24):
hh = hh - 24
print(str(hh)+" : "+str(mm)+" : "+str(ss))
Explanation:
We start by getting the time of the day. This is done using the next three lines
hh = int(input("Hour: ")) * 3600
mm = int(input("Minutes: ")) * 60
ss = int(input("Seconds: "))
Then, we get the additional seconds
seconds = int(input("Additional Seconds: "))
The new time is then calculated (in seconds)
time = hh+ mm + ss + seconds
This line extracts the hours from the calculated time (in seconds)
hh = int(time/3600)
time = time - hh * 3600
This line extracts the minutes from the calculated time (in seconds)
mm = int(time/60)
This line gets the remaining seconds
ss = time - mm * 60
The following iteration ensures that the hour is less than 24
while(hh>24):
hh = hh - 24
This prints the calculated time
print(str(hh)+" : "+str(mm)+" : "+str(ss))
Thank you for choosing our service. We're dedicated to providing the best answers for all your questions. Visit us again. Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. Get the answers you need at Westonci.ca. Stay informed with our latest expert advice.