Time Decomposition (3) X16253


Statement
 

pdf   zip

html

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

Write a function decompose(n) that receives as argument a quantity of seconds n, and returns how many hours h, minutes m and seconds s it represents.

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

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