File tree Expand file tree Collapse file tree
days/01-03-datetimes/code Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,14 +30,11 @@ def convert_to_datetime(line):
3030def time_between_shutdowns (loglines ):
3131 shutdowntimes = []
3232 for line in loglines :
33- # line = (line.strip('. \n'))
34- # words = line.split(" ")
35- # event = ' '.join(words[3:5])
3633 if SHUTDOWN_EVENT in line :
3734 dt = convert_to_datetime (line )
3835 shutdowntimes .append (dt )
3936 if len (shutdowntimes ) > 0 :
40- shutdown_delta = (shutdowntimes [ - 1 ] - shutdowntimes [ 0 ] )
37+ shutdown_delta = max (shutdowntimes ) - min ( shutdowntimes )
4138 return (shutdown_delta )
4239 '''TODO 2:
4340 Extract shutdown events ("Shutdown initiated") from loglines and calculate the
@@ -47,4 +44,4 @@ def time_between_shutdowns(loglines):
4744
4845
4946tbs = time_between_shutdowns (loglines )
50- print (tbs )
47+ print ('Time between shutdowns = ' + str ( tbs ) )
You can’t perform that action at this time.
0 commit comments