/**
 * Calculates the resistance of an electrical component given the voltage across it and the current flowing through it.
 *
 * Your task is to complete the code by using the unconditioned ternary operator and the enumerate function.
 *
 * @param voltage The voltage across the component.
 * @param current The current flowing through the component.
 * @return The calculated resistance.
 */
fun calculateResistance(voltage: Float, current: Float): Float {

    val values = listOf(5, 10, 15, 20, 25, 30, 35)
    
    // Complete the code below:
    val resistance = values.mapIndexed { index, value -> if (index % 2 == 0) value else index }.sum() / voltage * current
    
    return resistance
}
/**
 * Calculates the resistance of an electrical component given the voltage across it and the current flowing through it.
 *
 * Your task is to complete the code by using the unconditioned ternary operator and the enumerate function.
 *
 * @param voltage The voltage across the component.
 * @param current The current flowing through the component.
 * @return The calculated resistance.
 */
fun calculateResistance(voltage: Float, current: Float): Float {
/**
 * Calculates the resistance of an electrical component given the voltage across it and the current flowing through it.
 *
 * Your task is to complete the code by using the unconditioned ternary operator and the enumerate function.
 *
 * @param voltage The voltage across the component.
 * @param current The current flowing through the component.
 * @return The calculated resistance.
 */
fun calculateResistance(voltage: Float, current: Float): Float {

    val values = listOf(5, 10, 15, 20, 25, 30, 35)
    
    // Complete the code below:
    val resistance = values.mapIndexed { index, value -> if (index % 2 == 0) value else index }.sum() / voltage * current
    
    return resistance
}