We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ffe4ae0 commit 0cebd2bCopy full SHA for 0cebd2b
scripts/06_execution_time.py
@@ -1,17 +1,3 @@
1
-"""
2
-ExecutionTime
3
-
4
-This class is used for timing execution of code.
5
6
-For example:
7
8
- timer = ExecutionTime()
9
- print 'Hello world!'
10
- print 'Finished in {} seconds.'.format(timer.duration())
11
12
13
14
15
import time
16
import random
17
@@ -26,9 +12,12 @@ def duration(self):
26
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]
+sample_list = []
+
18
+for num in range(1, 1000000):
19
+ if num % 2 == 0:
20
+ random_number = random.randint(1, 888898)
21
+ sample_list.append(random_number)
22
34
23
print('Finished in {} seconds.'.format(timer.duration()))
0 commit comments