Skip to content

Commit 2aa70d8

Browse files
committed
corrected bite7.py
1 parent 072bf89 commit 2aa70d8

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

days/01-03-datetimes/code/bite7.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,11 @@ def convert_to_datetime(line):
3030
def 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

4946
tbs = time_between_shutdowns(loglines)
50-
print(tbs)
47+
print('Time between shutdowns = ' + str(tbs))

0 commit comments

Comments
 (0)