# Name # CSE 160 # Autumn 2025 # Coding Practice 4 # Problem 1 def average_pages(): ''' Write a function average_pages, that takes in a nested list of integers. Each list inside represents a book series, and each integer represents the number of pages in a book of that series. Determine the average number of pages per book series, and then append the average for each series into a new list. Return the list of averages. DO NOT use Python's built-in sum() method! ''' # Write your solution to Problem 1 here ''' Example: average_pages([[315, 427, 395], [682, 590, 825], [465, 546]]) returns [379.0, 699.0, 505.5] ''' # Problem 2 def sort_books(): ''' Write a function sort_books, that takes in a nested list where the first inner list is a list of books and the second is a list of their genres in RESPECTIVE order. Return a dictionary that maps each book to its genre. You can assume that both inner lists will always have the same number of items. ''' # Write your solution to Problem 2 here ''' Example: sort_books([["Parable of the Sower", "Crying in H-Mart", "Sapiens"], ["Sci-Fi", "Memoir", "Non-fiction"]]) returns {"Parable of the Sower": "Sci-Fi","Crying in H-Mart": "Memoir", "Sapiens": "Non-fiction"} ''' # Problem 3 def count_genre(): ''' Write a function count_genre, that takes in a dictionary like the one sort_books returns and a String representing a given genre. Return the number of times that genre appears in the dictionary. The function should return None if no books of the given genre are present in the dictionary ''' # Write your solution to Problem 3 here ''' Examples: dict = {"Crying in H-Mart": "Memoir", "Glass Castle": "Memoir", "Sapiens": "Non-fiction"} count_genre(dict, "Memoir") returns 2 count_genre(dict, "Non-fiction") returns 1 count_genre(dict, "Fiction") returns None '''