-
Notifications
You must be signed in to change notification settings - Fork 0
/
timeConvert.py
40 lines (29 loc) · 887 Bytes
/
timeConvert.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#CONVERTING HERO HOURS TO SECONDS
def hourSeconds(heroTime):
hourSecs = 0
splitTimes = heroTime.split(":")
hours = int(splitTimes[0])
hourSecs = hours * 3600
return hourSecs
#CONVERTING HERO MINUTES TO SECONDS
def minutesSeconds(heroTime):
minSecs = 0
splitTimes = heroTime.split(":")
minutes = int(splitTimes[1])
minSecs = minutes * 60
return minSecs
#GETTING HERO SECONDS
def heroSeconds(heroTime):
seconds = 0
splitTimes = heroTime.split(":")
seconds = int(splitTimes[2])
#no further arithmetic???
return seconds
#ADDING ALL THE SECONDS GATHERED TO A TOTAL SECONDS
def totalSeconds(heroTime):
totalSeconds = 0
hourSecs = hourSeconds(heroTime)
minSecs = minutesSeconds(heroTime)
seconds = heroSeconds(heroTime)
totalSeconds = hourSecs + minSecs + seconds
return totalSeconds