/**
 * Given two lists of electrical power consumption for different appliances,
 * calculate the total power consumption considering only the common appliances
 * in both lists.
 *
 * @param array1 A list of electrical power consumption for appliances
 * @param array2 A list of electrical power consumption for appliances
 * @return The total power consumption of the common appliances in both lists
 *
 * Example:
 * calculateTotalPower(listOf(100, 200, 300, 400), listOf(200, 300, 500, 600))
 * Output: 500.0
 */
fun calculateTotalPower(array1: List<Int>, array2: List<Int>): Double {

    val commonAppliances = array1.intersect(array2)
    var totalPower = 0.0

    for (appliancePower in commonAppliances) {
        totalPower += appliancePower
    }

    return totalPower
}
/**
 * Given two lists of electrical power consumption for different appliances,
 * calculate the total power consumption considering only the common appliances
 * in both lists.
 *
 * @param array1 A list of electrical power consumption for appliances
 * @param array2 A list of electrical power consumption for appliances
 * @return The total power consumption of the common appliances in both lists
 *
 * Example:
 * calculateTotalPower(listOf(100, 200, 300, 400), listOf(200, 300, 500, 600))
 * Output: 500.0
 */
fun calculateTotalPower(array1: List<Int>, array2: List<Int>): Double {
/**
 * Given two lists of electrical power consumption for different appliances,
 * calculate the total power consumption considering only the common appliances
 * in both lists.
 *
 * @param array1 A list of electrical power consumption for appliances
 * @param array2 A list of electrical power consumption for appliances
 * @return The total power consumption of the common appliances in both lists
 *
 * Example:
 * calculateTotalPower(listOf(100, 200, 300, 400), listOf(200, 300, 500, 600))
 * Output: 500.0
 */
fun calculateTotalPower(array1: List<Int>, array2: List<Int>): Double {

    val commonAppliances = array1.intersect(array2)
    var totalPower = 0.0

    for (appliancePower in commonAppliances) {
        totalPower += appliancePower
    }

    return totalPower
}