From 998130ea46755bffdcf37e3b8951473be92f9a3b Mon Sep 17 00:00:00 2001 From: Von Random Date: Wed, 27 Apr 2016 14:45:46 +0300 Subject: [PATCH] seconds-to-hr as a script as well --- seconds-to-hr.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 seconds-to-hr.py diff --git a/seconds-to-hr.py b/seconds-to-hr.py new file mode 100755 index 0000000..54658d6 --- /dev/null +++ b/seconds-to-hr.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python2 +from sys import argv + +input = int(argv[1]) +result = str() +days = input // 86400 +hours = input // 3600 % 24 +minutes = input // 60 % 60 +seconds = input % 60 +result = '{}d {}h {}m {}s'.format(days, hours, minutes, seconds) +print(result)