PY-44
Account for Every Line Ending
Task
Write scan_line_endings(data), where data is a bytes value. Return one
record for every line while distinguishing these endings:
"LF"forb"\n";"CRLF"for the two-byte sequenceb"\r\n";"CR"for a loneb"\r";"NONE"for a final line with no ending.
Each record is a five-item tuple:
(line_number, start, content_end, end, ending)
Positions are zero-based byte offsets. start:content_end is the line content;
content_end:end is its ending. Line numbers begin at 1. A terminating line
ending closes the current line but does not create an extra empty line after
the end of the input. An empty input returns []; consecutive endings do
create empty lines.
Example
The spans account for every byte exactly once. CRLF is one ending, not a
lone CR followed by an empty LF line.
Your implementation
Edit solution.py and keep this function signature:
Return a new list of tuples. Do not decode or change data, print, or ask for
input.