Skip to main content
πŸ”’ Preview mode. The first 15 Foundations lessons are free; this one is Pro. Start a 7-day trial to unlock the editor, AI hints and the the rest of the curriculum. Card required, cancel any time in Dashboard.Start 7-day trial β†’
⚑
← Coursesβ€ΊCreative ChallengesModule 8 Β· 🎯 Performance Showdowns Β· Recapβ€ΊπŸŽ― Review: Creative module 8 recapscenario84 / 104
+80 XP
Task
Build `code_golf_charcount(code, ignore_whitespace)` β€” the scorer for code golf submissions: - `ignore_whitespace=False` β†’ return `len(code)` (raw, including spaces and newlines). - `ignore_whitespace=True` β†’ return count of non-whitespace characters only. - Empty string β†’ `0` (in both modes). - A character is "whitespace" iff `ch.isspace()` is True (covers space, tab, newline, vertical tab, etc.). The two modes mirror two leagues: "true golf" (every byte counts) vs "logic golf" (formatting free).
✏️ Write your code here
🐍
Loading Python...
One-time download (~1 MB). Then it runs instantly.
πŸ“Š Result
Press Run to see result...

πŸ’¬ Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…