Skip to main content

Practice ยท 1 of 3

Longest Line, Streaming

Implement longest_line(path) returning the longest line (stripped of the trailing newline) of a text file WITHOUT loading the whole file โ€” iterate lazily. Empty file returns ''.

Difficulty: intermediate

Back to lesson: Practice: Streaming Drills