/**
 * Electrician needs to update a specific element in a tuple.
 * Complete the function 'updateTuple' which takes in an index, a value, and a tuple,
 * and replaces the element at the given index with the given value.
 *
 * @param index The index of the element to be updated.
 * @param value The value to replace the element at the given index.
 * @param tuple The input tuple.
 * @return The updated tuple.
 *
 * Example:
 * updateTuple(2, "GFCI", listOf("Switch", "Outlet", "Socket", "Circuit Breaker"))
 * Output: listOf("Switch", "Outlet", "GFCI", "Circuit Breaker")
 */
fun updateTuple(index: Int, value: Any, tuple: List<Any>): List<Any> {

    // Convert the tuple to a mutable list
    val list = tuple.toMutableList()

    // Update the element at the given index with the value
    list[index] = value

    // Convert the updated list back to a tuple
    return list.toList()
}
/**
 * Electrician needs to update a specific element in a tuple.
 * Complete the function 'updateTuple' which takes in an index, a value, and a tuple,
 * and replaces the element at the given index with the given value.
 *
 * @param index The index of the element to be updated.
 * @param value The value to replace the element at the given index.
 * @param tuple The input tuple.
 * @return The updated tuple.
 *
 * Example:
 * updateTuple(2, "GFCI", listOf("Switch", "Outlet", "Socket", "Circuit Breaker"))
 * Output: listOf("Switch", "Outlet", "GFCI", "Circuit Breaker")
 */
fun updateTuple(index: Int, value: Any, tuple: List<Any>): List<Any> {
/**
 * Electrician needs to update a specific element in a tuple.
 * Complete the function 'updateTuple' which takes in an index, a value, and a tuple,
 * and replaces the element at the given index with the given value.
 *
 * @param index The index of the element to be updated.
 * @param value The value to replace the element at the given index.
 * @param tuple The input tuple.
 * @return The updated tuple.
 *
 * Example:
 * updateTuple(2, "GFCI", listOf("Switch", "Outlet", "Socket", "Circuit Breaker"))
 * Output: listOf("Switch", "Outlet", "GFCI", "Circuit Breaker")
 */
fun updateTuple(index: Int, value: Any, tuple: List<Any>): List<Any> {

    // Convert the tuple to a mutable list
    val list = tuple.toMutableList()

    // Update the element at the given index with the value
    list[index] = value

    // Convert the updated list back to a tuple
    return list.toList()
}