/**
 * This exercise focuses on calculating the average rating for all books in a library.
 */
fun calculateAverageRating(library: List<Map<String, List<Double>>>) : Double {

    var totalSum = 0.0
    var count = 0

    // Iterate over each book in the library
    for (book in library) {
        // Iterate over each rating for the current book
        for (rating in book["ratings"]!!) {
            // Update the sum of ratings
            totalSum += rating
            // Increase the count of ratings
            count++
        }
    }

    // Calculate the average rating using floating-point arithmetic
    val averageRating = totalSum / count.toDouble()

    return averageRating
}
/**
 * This exercise focuses on calculating the average rating for all books in a library.
 */
fun calculateAverageRating(library: List<Map<String, List<Double>>>) : Double {
/**
 * This exercise focuses on calculating the average rating for all books in a library.
 */
fun calculateAverageRating(library: List<Map<String, List<Double>>>) : Double {

    var totalSum = 0.0
    var count = 0

    // Iterate over each book in the library
    for (book in library) {
        // Iterate over each rating for the current book
        for (rating in book["ratings"]!!) {
            // Update the sum of ratings
            totalSum += rating
            // Increase the count of ratings
            count++
        }
    }

    // Calculate the average rating using floating-point arithmetic
    val averageRating = totalSum / count.toDouble()

    return averageRating
}