Skip to content

Commit a50c31a

Browse files
authored
Update 06_execution_time.py
1 parent cb448c2 commit a50c31a

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

scripts/06_execution_time.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,28 @@
1212
"""
1313

1414

15-
import time
16-
import random
17-
1815

1916
class ExecutionTime:
2017
def __init__(self):
2118
self.start_time = time.time()
2219

2320
def duration(self):
2421
return time.time() - self.start_time
22+
23+
timer = ExecutionTime()
24+
25+
for i in range(1,1000000):
26+
if i % 2 == 0:
27+
sample_list.apppend(random.randint(1, 888898))
28+
29+
for i in range(10)
30+
print("11111")
31+
32+
33+
print('Finished in {} seconds.'.format(timer.duration()))
34+
# sample_list = list()
35+
# my_list = [random.randint(1, 888898) for num in
36+
# range(1, 1000000) if num % 2 == 0]
37+
# print('Finished in {} seconds.'.format(timer.duration()))
2538

2639

27-
# ---- run code ---- #
28-
29-
30-
timer = ExecutionTime()
31-
sample_list = list()
32-
my_list = [random.randint(1, 888898) for num in
33-
range(1, 1000000) if num % 2 == 0]
34-
print('Finished in {} seconds.'.format(timer.duration()))

0 commit comments

Comments
 (0)