Wrap-up: a small program

A small word-counting program in Python and JavaScript, using every symbol so far.

Lesson 16 / 16
Put your fingers on the home position (F and J) and press Space to start
from collections import Counter def top_words(text, n=3): words = text.lower().split() counts = Counter(w.strip(".,!?") for w in words) return counts.most_common(n) const countWords = (text) => { const counts = {}; for (const w of text.toLowerCase().split(" ")) { counts[w] = (counts[w] ?? 0) + 1; } return Object.entries(counts).sort((a, b) => b[1] - a[1]); };
 
Lesson 16: Wrap-up: a small program | Typing code|TypingStep