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β€ΊPython FoundationsModule 4 Β· Object-oriented programmingβ€ΊπŸŽ― Review Β· safe CSV parserscenario66 / 174
+50 XP
Task
Write `parse_csv(line)` that takes a string like `"10, 20, oops, 30 , , 5"` and returns a tuple `(total, biggest)` where: - `total` is the sum of all values that successfully parse as `int` (here: 10+20+30+5 = 65) - `biggest` is the max of those same values (here: 30) - silently skip empty pieces and pieces that don't parse β€” use `try/except ValueError` per piece Then call it with `"10, 20, oops, 30 , , 5"` and print `total` and `biggest` on separate lines. Expected output: ``` 65 30 ```
✏️ 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…