File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change
1
+ def make_readable (seconds ): #Function converts an amount of seconds into hours:minutes:seconds
2
+
3
+ seconds = int (seconds ) #converts seconds into integer
4
+
5
+ hour = int (seconds / 3600 ) #Gets hours
6
+ minute = int (seconds / 60 ) - (hour * 60 ) #Gets remanining minutes
7
+ second = seconds - (minute * 60 ) - (hour * 3600 ) #Gets remaining seconds
8
+
9
+ hour = str (hour ) if len (str (hour )) > 1 else '0' + str (hour ) #adds 0 if the hours,minutes or seconds are only one charachter long
10
+ second = str (second ) if len (str (second )) > 1 else '0' + str (second )
11
+ minute = str (minute ) if len (str (minute )) > 1 else '0' + str (minute )
12
+
13
+ return f"{ hour } :{ minute } :{ second } " #returns the value
14
+
15
+ print (make_readable (input ('' )))
16
+ input ('' )
You can’t perform that action at this time.
0 commit comments