File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 24
24
25
25
def countDistictWords (filename ):
26
26
27
- start = time .clock ()
27
+ start = time .perf_counter ()
28
28
29
29
# Step 1: Read the entire book into a string.
30
30
try :
@@ -40,7 +40,7 @@ def countDistictWords(filename):
40
40
contents = contents .replace (c , ' ' )
41
41
contents = contents .lower ()
42
42
43
- # Step 3: Split the ftlString up into an array of words.
43
+ # Step 3: Split the string into a list of words.
44
44
words = contents .split ()
45
45
print ('Number of words: %i' % (len (words )))
46
46
@@ -53,7 +53,7 @@ def countDistictWords(filename):
53
53
wordOcc [word ] = 1
54
54
print ('Number of distinct words: %i' % (len (wordOcc )))
55
55
56
- finish = time .clock ()
56
+ finish = time .perf_counter ()
57
57
print ('Counted all distinct words in %s in %f s' % (filename , finish - start ))
58
58
59
59
You can’t perform that action at this time.
0 commit comments