Seconds to HH:MM:SS
Python
Easy
5 views
Problem Description
Total seconds S is provided. Convert it to hh:mm:ss (00 padded) assuming 0
Input Format
One integer S.
Output Format
One time string HH:MM:SS.
Official Solution
import sys
s=sys.stdin.read().strip()
if not s: sys.exit(0)
S=int(s)
h=S//3600
m=(S%3600)//60
sec=S%60
sys.stdout.write(f"{h:02d}:{m:02d}:{sec:02d}")
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!