/**
 * Given a dictionary and a list, this function calculates the sum of all the values in the dictionary
 * whose corresponding keys are present in the list.
 *
 * @param dictionary A dictionary with string keys and float values
 * @param list A list of string keys
 * @return The sum of the values in the dictionary whose keys are present in the list
 *
 * Example:
 * val dictionary = mapOf("a" to 1.2, "b" to 3.4, "c" to 5.6, "d" to 7.8)
 * val list = listOf("a", "c", "e")
 * accessElements(dictionary, list) // Output: 6.8
 */
fun accessElements(dictionary: Map<String, Double>, list: List<String>): Double {

    var sumValues = 0.0

    for (key in list) {
        if (dictionary.containsKey(key)) {
            sumValues += dictionary.getValue(key)
        }
    }

    return sumValues
}
/**
 * Given a dictionary and a list, this function calculates the sum of all the values in the dictionary
 * whose corresponding keys are present in the list.
 *
 * @param dictionary A dictionary with string keys and float values
 * @param list A list of string keys
 * @return The sum of the values in the dictionary whose keys are present in the list
 *
 * Example:
 * val dictionary = mapOf("a" to 1.2, "b" to 3.4, "c" to 5.6, "d" to 7.8)
 * val list = listOf("a", "c", "e")
 * accessElements(dictionary, list) // Output: 6.8
 */
fun accessElements(dictionary: Map<String, Double>, list: List<String>): Double {
/**
 * Given a dictionary and a list, this function calculates the sum of all the values in the dictionary
 * whose corresponding keys are present in the list.
 *
 * @param dictionary A dictionary with string keys and float values
 * @param list A list of string keys
 * @return The sum of the values in the dictionary whose keys are present in the list
 *
 * Example:
 * val dictionary = mapOf("a" to 1.2, "b" to 3.4, "c" to 5.6, "d" to 7.8)
 * val list = listOf("a", "c", "e")
 * accessElements(dictionary, list) // Output: 6.8
 */
fun accessElements(dictionary: Map<String, Double>, list: List<String>): Double {

    var sumValues = 0.0

    for (key in list) {
        if (dictionary.containsKey(key)) {
            sumValues += dictionary.getValue(key)
        }
    }

    return sumValues
}