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 rest of the curriculum. Card required, cancel any time in Dashboard.Start 7-day trial →
← CoursesPython FoundationsModule 9 · Bonus: mini-projectsMINI: Log parser — top 3 IPs by error countmission171 / 174
+200 XP
Task
Implement `top_error_ips(lines, n=3)` for nginx-style log lines. Run it three times so we cover both boundaries plus the canonical case: 1. canonical sample (8 lines, mixed 5xx/2xx) with n=3 → top 3 error IPs 2. empty list with n=3 → empty result (boundary: no input) 3. canonical sample with n=1 → top 1 only (boundary: small n) Print each result on its own line. Expected: [('10.0.0.5', 3), ('10.0.0.7', 2), ('10.0.0.1', 1)] [] [('10.0.0.5', 3)]
✏️ 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…