Time Decomposition (3) X16253


Statement
 

pdf   zip

[Like Time Decomposition (2), P22654, but for Python instead of C.]

Write a function @decompose(n)@ that receives as argument a quantity of seconds nn, and returns how many hours hh, minutes mm and seconds ss it represents.

That is, we must have 3600h+60m+s=n3600h + 60m + s = n, with 0<=s<600 <= s < 60 and 0<=m<600 <= m < 60.

Sample session

Sample session
>>> decompose(147)
(0, 2, 27)
>>> decompose(3661)
(1, 1, 1)
>>> decompose(76234)
(21, 10, 34)
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python