summaryrefslogtreecommitdiff
path: root/wk7/lect/favorites.py
diff options
context:
space:
mode:
Diffstat (limited to 'wk7/lect/favorites.py')
-rw-r--r--wk7/lect/favorites.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/wk7/lect/favorites.py b/wk7/lect/favorites.py
index fcdc97c..68fa769 100644
--- a/wk7/lect/favorites.py
+++ b/wk7/lect/favorites.py
@@ -15,6 +15,5 @@ with open("favorites.csv") as file:
favorite = row["language"]
counts[favorite] += 1
-for favorite in sorted(counts, key=counts.get, reverse=True):
- print(favorite, ':', counts[favorite])
-
+for favorite, count in counts.most_common():
+ print(f"{favorite}: {count}")