/**
 * This function calculates the total power consumed by the electrician's devices over a period of time.
 *
 * @param hours The number of hours the devices were used.
 * @param devices A list of dictionaries representing the devices with their power consumption and time used.
 * @return The total power consumed in kilowatt-hours (kWh).
 */
fun calculateTotalPower(hours: Int, devices: List<Map<String, Int>>): Float {

    var totalPower = 0f

    for (device in devices) {
        val powerConsumed = device["power_consumption"] ?: 0
        val timeUsed = device["time_used"] ?: 0

        totalPower += powerConsumed * timeUsed
    }

    return totalPower * hours
}
/**
 * This function calculates the total power consumed by the electrician's devices over a period of time.
 *
 * @param hours The number of hours the devices were used.
 * @param devices A list of dictionaries representing the devices with their power consumption and time used.
 * @return The total power consumed in kilowatt-hours (kWh).
 */
fun calculateTotalPower(hours: Int, devices: List<Map<String, Int>>): Float {
/**
 * This function calculates the total power consumed by the electrician's devices over a period of time.
 *
 * @param hours The number of hours the devices were used.
 * @param devices A list of dictionaries representing the devices with their power consumption and time used.
 * @return The total power consumed in kilowatt-hours (kWh).
 */
fun calculateTotalPower(hours: Int, devices: List<Map<String, Int>>): Float {

    var totalPower = 0f

    for (device in devices) {
        val powerConsumed = device["power_consumption"] ?: 0
        val timeUsed = device["time_used"] ?: 0

        totalPower += powerConsumed * timeUsed
    }

    return totalPower * hours
}