/**
 * Calculate the average temperature for a given set of data points, excluding any that are below a certain threshold.
 *
 * @param temperatures List of temperatures in Celsius.
 * @param threshold Minimum temperature allowed.
 * @return The average temperature after excluding any values below the threshold.
 */
fun calculateAverageTemperature(temperatures: List<Double>, threshold: Double): Double {

    var sumTemperatures = 0.0
    var count = 0
    var index = 0

    while (index < temperatures.size) {
        val temperature = temperatures[index]

        if (temperature >= threshold) {
            sumTemperatures += temperature
            count++
        }

        index++
    }

    return if (count > 0) sumTemperatures / count else 0.0
}
/**
 * Calculate the average temperature for a given set of data points, excluding any that are below a certain threshold.
 *
 * @param temperatures List of temperatures in Celsius.
 * @param threshold Minimum temperature allowed.
 * @return The average temperature after excluding any values below the threshold.
 */
fun calculateAverageTemperature(temperatures: List<Double>, threshold: Double): Double {
/**
 * Calculate the average temperature for a given set of data points, excluding any that are below a certain threshold.
 *
 * @param temperatures List of temperatures in Celsius.
 * @param threshold Minimum temperature allowed.
 * @return The average temperature after excluding any values below the threshold.
 */
fun calculateAverageTemperature(temperatures: List<Double>, threshold: Double): Double {

    var sumTemperatures = 0.0
    var count = 0
    var index = 0

    while (index < temperatures.size) {
        val temperature = temperatures[index]

        if (temperature >= threshold) {
            sumTemperatures += temperature
            count++
        }

        index++
    }

    return if (count > 0) sumTemperatures / count else 0.0
}