Fix printing total run time.
This commit is contained in:
@@ -5,11 +5,11 @@ from os.path import isdir, isfile
|
|||||||
from subprocess import Popen, PIPE, CalledProcessError
|
from subprocess import Popen, PIPE, CalledProcessError
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
|
total_run_time = 0
|
||||||
for dir in [x for x in sorted(listdir('.')) if isdir(x)]:
|
for dir in [x for x in sorted(listdir('.')) if isdir(x)]:
|
||||||
file = dir + '/' + dir + '.py'
|
file = dir + '/' + dir + '.py'
|
||||||
input = dir + '/input.txt'
|
input = dir + '/input.txt'
|
||||||
total_run_time = 0
|
|
||||||
if isfile(file) and isfile(input):
|
if isfile(file) and isfile(input):
|
||||||
print('--------------------------------')
|
print('--------------------------------')
|
||||||
print(dir, ':', sep='')
|
print(dir, ':', sep='')
|
||||||
@@ -23,5 +23,5 @@ for dir in [x for x in sorted(listdir('.')) if isdir(x)]:
|
|||||||
run_time = end_time-start_time
|
run_time = end_time-start_time
|
||||||
total_run_time += run_time
|
total_run_time += run_time
|
||||||
print(f'Runtime: {run_time:.2f} s')
|
print(f'Runtime: {run_time:.2f} s')
|
||||||
print('--------------------------------')
|
print('--------------------------------')
|
||||||
print(f'Runtime: {total_run_time:.2f} s')
|
print(f'Runtime: {total_run_time:.2f} s')
|
||||||
|
|||||||
Reference in New Issue
Block a user