/**
 * A farmer wants to calculate the total weight of the items he has in his barn.
 * The items are stored in a map where the keys represent the item names,
 * and the values represent their weights. Write a function that takes the map
 * as input and returns the total weight of all the items.
 *
 * Example:
 * items = mapOf("apple" to 0.1, "carrot" to 0.2, "banana" to 0.15)
 * calculateTotalWeight(items) -> 0.45
 *
 * @param items A map representing the items and their corresponding weights.
 * @return totalWeight A float value representing the total weight of all the items.
 *
 * Notes:
 * - Your solution should sum up all the values of the map.
 */
fun calculateTotalWeight(items: Map<String, Double>): Double {

    var totalWeight = 0.0

    // Iterate over each key-value pair in the map
    for ((_, weight) in items) {
        totalWeight += weight
    }

    return totalWeight
}

val items = mapOf("apple" to 0.1, "carrot" to 0.2, "banana" to 0.15)
val totalWeight = calculateTotalWeight(items)
/**
 * A farmer wants to calculate the total weight of the items he has in his barn.
 * The items are stored in a map where the keys represent the item names,
 * and the values represent their weights. Write a function that takes the map
 * as input and returns the total weight of all the items.
 *
 * Example:
 * items = mapOf("apple" to 0.1, "carrot" to 0.2, "banana" to 0.15)
 * calculateTotalWeight(items) -> 0.45
 *
 * @param items A map representing the items and their corresponding weights.
 * @return totalWeight A float value representing the total weight of all the items.
 *
 * Notes:
 * - Your solution should sum up all the values of the map.
 */
fun calculateTotalWeight(items: Map<String, Double>): Double {
/**
 * A farmer wants to calculate the total weight of the items he has in his barn.
 * The items are stored in a map where the keys represent the item names,
 * and the values represent their weights. Write a function that takes the map
 * as input and returns the total weight of all the items.
 *
 * Example:
 * items = mapOf("apple" to 0.1, "carrot" to 0.2, "banana" to 0.15)
 * calculateTotalWeight(items) -> 0.45
 *
 * @param items A map representing the items and their corresponding weights.
 * @return totalWeight A float value representing the total weight of all the items.
 *
 * Notes:
 * - Your solution should sum up all the values of the map.
 */
fun calculateTotalWeight(items: Map<String, Double>): Double {

    var totalWeight = 0.0

    // Iterate over each key-value pair in the map
    for ((_, weight) in items) {
        totalWeight += weight
    }

    return totalWeight
}

val items = mapOf("apple" to 0.1, "carrot" to 0.2, "banana" to 0.15)
val totalWeight = calculateTotalWeight(items)