Skip to content

Commit 8c0f58c

Browse files
author
Karan Goel
committed
2 parents 7b99150 + bb4c5a0 commit 8c0f58c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Text/count_words.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@
2222
reverse=True)
2323

2424
# print top 5 words
25-
for (i, (word, count)) in enumerate(sorted_counts):
26-
if i < 5:
25+
for (word,count) in sorted_counts[:5]: # thanks @jrwren for this!
2726
print (word, count)

0 commit comments

Comments
 (0)