/**
 * Calculate the average temperature of a given dataset.
 *
 * Each tuple in the dataset contains the temperature recorded in 3 different locations.
 * The dataset is a list of such tuples.
 *
 * @param temperatureData The dataset containing temperature records.
 * @return The average temperature of the dataset rounded to 2 decimal places.
 */
fun calculateAverageTemperature(temperatureData: List<Triple<Int, Int, Int>>): Double {

    var totalTemperature = 0

    for (data in temperatureData) {
        totalTemperature += data.first + data.second + data.third
    }

    val averageTemperature = totalTemperature / (temperatureData.size * 3.0)

    return averageTemperature.round(2)
}

fun Double.round(decimals: Int): Double = "%.${decimals}f".format(this).toDouble()
/**
 * Calculate the average temperature of a given dataset.
 *
 * Each tuple in the dataset contains the temperature recorded in 3 different locations.
 * The dataset is a list of such tuples.
 *
 * @param temperatureData The dataset containing temperature records.
 * @return The average temperature of the dataset rounded to 2 decimal places.
 */
fun calculateAverageTemperature(temperatureData: List<Triple<Int, Int, Int>>): Double {
/**
 * Calculate the average temperature of a given dataset.
 *
 * Each tuple in the dataset contains the temperature recorded in 3 different locations.
 * The dataset is a list of such tuples.
 *
 * @param temperatureData The dataset containing temperature records.
 * @return The average temperature of the dataset rounded to 2 decimal places.
 */
fun calculateAverageTemperature(temperatureData: List<Triple<Int, Int, Int>>): Double {

    var totalTemperature = 0

    for (data in temperatureData) {
        totalTemperature += data.first + data.second + data.third
    }

    val averageTemperature = totalTemperature / (temperatureData.size * 3.0)

    return averageTemperature.round(2)
}

fun Double.round(decimals: Int): Double = "%.${decimals}f".format(this).toDouble()