You are given books, a list of tuples. Each tuple has the form (title, genre, pages, year) where title is a str, genre is a str, pages is an int and year is an int.
Return a dictionary that maps each genre to the total number of pages summed over all books of that genre.
If books is empty, return an empty dictionary.
NOTE: This is a function-type question — you only write the function. Do not read input or print anything; a hidden checker calls your function and checks its return value.
Arguments
[('Dune', 'sci-fi', 412, 1965), ('Hyperion', 'sci-fi', 482, 1989), ('Emma', 'classic', 474, 1815)]
Returns
{'sci-fi': 894, 'classic': 474}