Zum Hauptinhalt springen
🔒 Vorschaumodus. Die ersten fünfzehn Foundations-Lektionen sind kostenlos; diese hier ist Pro. Starte einen 7-Tage-Trial, um den Editor, AI-Hinweise und den Rest des Lehrplans freizuschalten. Karte erforderlich, jederzeit im Dashboard kündbar.7-Tage-Trial starten →
← KursePython FoundationsModule 9 · Bonus: mini-projectsMINI: Log parser — top 3 IPs by error countmission171 / 174
+200 XP
Aufgabe🌐 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)]
✏️ Schreibe deinen Code hier
🐍
Python wird geladen...
Einmaliger Download (~1 MB). Danach läuft alles sofort.
📊 Ergebnis
Klicke auf Ausführen, um das Ergebnis zu sehen...

💬 Diskussion

Sei der erste — stelle eine Frage oder teile einen Tipp.
Anmelden um an der Diskussion teilzunehmen. Lesen ist kostenlos.
Diskussion wird geladen…