Naar hoofdinhoud
🔒 Voorbeeldmodus. De eerste vijftien Foundations-lessen zijn gratis; deze is Pro. Start een 7-daagse trial om de editor, AI-hints en de rest van het curriculum te ontgrendelen. Kaart vereist, op elk moment opzegbaar in Dashboard.Start 7-daagse trial →
← CursussenPython FoundationsModule 9 · Bonus: mini-projectsMINI: Log parser — top 3 IPs by error countmission171 / 174
+200 XP
Opdracht🌐 shown in RU
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)]
✏️ Schrijf hier je code
🐍
Python laden...
Eenmalige download (~1 MB). Daarna direct beschikbaar.
📊 Resultaat
Klik op Uitvoeren om het resultaat te zien...

💬 Discussie

Wees de eerste — stel een vraag of deel een tip.
Log in om mee te doen aan de discussie. Lezen is gratis.
Discussie laden…