A file contains lines like '157,Kelly,a wrinkle in time,50' (reader ID, name, book name, number of pages). Fetch/download the file and calculate the total number of books and the total number of pages (e.g. 'Book count: 4', 'Page count: 850').
Asked in the Karat programming round stage. One of 3 programming questions; shell not allowed.
Implement summarize_reading_file(lines). The downloaded file is provided as a list of nonempty strings, one record per line. Return [book_count, page_count]. Each record's final comma-separated field is the integer page count, and book names may contain commas.
def summarize_reading_file(lines):