python intermediate 2026-11-17 结束

Parse a log file

Given lines from a web server access log, write summarise(lines) that returns a dict with:

  • "requests": number of valid lines
  • "errors": number of responses with status 500 or above
  • "top_path": the most requested path (ties: alphabetically first)
  • "bad_lines": number of lines that don't match the format

Line format: IP - - [time] "METHOD /path HTTP/1.1" STATUS BYTES

目前已有 0 人解出。

python
编辑器Ctrl + Enter

            
        

当测试输出 "All tests passed" 时,此挑战会在本浏览器中标记为已解决。

提交您的解决方案进行审核