ziggy
2010-10-04 23:21:40 UTC
eecs python hw4.py
File "hw4.py", line 34
hours2 = (int(y[0]) * 60**2)
^
SyntaxError: invalid syntax can anyone help me figure out why? I am trying to convert the time "H:MM:SS" into seconds so I can tell which time will be bigger
def maxtimes(time1, time2) :
x = gettime(time1)
y = gettime(time2)
hours1 = (int(x[0]) * 60**2)
minutes1 = (int(x[1]) * 60)
seconds1 = (int(x[2])
hours2 = (int(y[0]) * 60**2)
minutes2 = (int(y[1]) * 60)
seconds2 = (int(y[2])
totalseconds1 = hours1 + minutes1 + seconds1
totalseconds2 = hours2 + minutes2 + seconds2
if totalseconds1 > totalseconds2:
return (time1)
if totalseconds2 > totalseconds1:
return (time2)