/**
 * Given a list of rocket data, calculate the average distance traveled by each rocket.
 *
 * Each element in the list will be a Pair containing the rocket name and a list of distances traveled.
 * Return a map with the rocket names as keys and their average distances as values.
 *
 * Hint: You can use destructuring declaration to assign the rocket name and distances to separate variables.
 *
 * Example:
 * val rocketData = listOf(Pair("Falcon 9", listOf(100, 125, 150)), Pair("Atlas V", listOf(200, 250, 300)))
 * calculateAverageDistance(rocketData) -> mapOf("Falcon 9" to 125, "Atlas V" to 250)
 */
fun calculateAverageDistance(rocketData: List<Pair<String, List<Int>>>): Map<String, Double> {

    val rocketDistances = mutableMapOf<String, Double>()
    for ((rocket, distances) in rocketData) {
        val averageDistance = distances.sum().toDouble() / distances.size
        rocketDistances[rocket] = averageDistance
    }
    return rocketDistances
}
/**
 * Given a list of rocket data, calculate the average distance traveled by each rocket.
 *
 * Each element in the list will be a Pair containing the rocket name and a list of distances traveled.
 * Return a map with the rocket names as keys and their average distances as values.
 *
 * Hint: You can use destructuring declaration to assign the rocket name and distances to separate variables.
 *
 * Example:
 * val rocketData = listOf(Pair("Falcon 9", listOf(100, 125, 150)), Pair("Atlas V", listOf(200, 250, 300)))
 * calculateAverageDistance(rocketData) -> mapOf("Falcon 9" to 125, "Atlas V" to 250)
 */
fun calculateAverageDistance(rocketData: List<Pair<String, List<Int>>>): Map<String, Double> {
/**
 * Given a list of rocket data, calculate the average distance traveled by each rocket.
 *
 * Each element in the list will be a Pair containing the rocket name and a list of distances traveled.
 * Return a map with the rocket names as keys and their average distances as values.
 *
 * Hint: You can use destructuring declaration to assign the rocket name and distances to separate variables.
 *
 * Example:
 * val rocketData = listOf(Pair("Falcon 9", listOf(100, 125, 150)), Pair("Atlas V", listOf(200, 250, 300)))
 * calculateAverageDistance(rocketData) -> mapOf("Falcon 9" to 125, "Atlas V" to 250)
 */
fun calculateAverageDistance(rocketData: List<Pair<String, List<Int>>>): Map<String, Double> {

    val rocketDistances = mutableMapOf<String, Double>()
    for ((rocket, distances) in rocketData) {
        val averageDistance = distances.sum().toDouble() / distances.size
        rocketDistances[rocket] = averageDistance
    }
    return rocketDistances
}