Add One Second (2) X30674


Statement
 

pdf   zip

html

Write a function add1sec(h,m,s) that receives as argument a clock time, given in hours, minutes and seconds, and returns, again in hours, minutes and seconds, the clock time increased by one second. The arguments received fulfill the preconditions h<24, m<60 and s<60, and the resulting clock time must obey the same inequalities.

Sample session
>>> add1sec(0, 1, 2)
(0, 1, 3)
>>> add1sec(3, 5, 9)
(3, 5, 10)
>>> add1sec(19, 45, 59)
(19, 46, 0)
>>> add1sec(12, 59, 59)
(13, 0, 0)
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python