/**
 * Suppose you are an Accountant and you need to modify elements of a tuple using indexing.
 * Complete the code below to modify the tuple assigned to 'accountant' by replacing the element at the given 'index'
 * with the provided 'newValue'.
 *
 * @param accountant A tuple representing financial data.
 * @param index The index of the element to be modified.
 * @param newValue The new value to replace the old element.
 * @return The modified tuple with the element replaced.
 *
 * Note: You must not change the original tuple, but instead return a new tuple.
 *
 * Example:
 * var accountant = Triple(5000.25, 9342, 3421.50)
 * val newTuple = modifyTuple(accountant, 1, 7000)
 * println(newTuple)  // Output: (5000.25, 7000, 3421.50)
 */
fun modifyTuple(accountant: Triple<Double, Int, Double>, index: Int, newValue: Any): Triple<Double, Int, Double> {

    val modifiedList = accountant.toList().mapIndexed { i, value ->
        if (i == index) newValue else value
    }
    return Triple(modifiedList[0] as Double, modifiedList[1] as Int, modifiedList[2] as Double)
}
/**
 * Suppose you are an Accountant and you need to modify elements of a tuple using indexing.
 * Complete the code below to modify the tuple assigned to 'accountant' by replacing the element at the given 'index'
 * with the provided 'newValue'.
 *
 * @param accountant A tuple representing financial data.
 * @param index The index of the element to be modified.
 * @param newValue The new value to replace the old element.
 * @return The modified tuple with the element replaced.
 *
 * Note: You must not change the original tuple, but instead return a new tuple.
 *
 * Example:
 * var accountant = Triple(5000.25, 9342, 3421.50)
 * val newTuple = modifyTuple(accountant, 1, 7000)
 * println(newTuple)  // Output: (5000.25, 7000, 3421.50)
 */
fun modifyTuple(accountant: Triple<Double, Int, Double>, index: Int, newValue: Any): Triple<Double, Int, Double> {
/**
 * Suppose you are an Accountant and you need to modify elements of a tuple using indexing.
 * Complete the code below to modify the tuple assigned to 'accountant' by replacing the element at the given 'index'
 * with the provided 'newValue'.
 *
 * @param accountant A tuple representing financial data.
 * @param index The index of the element to be modified.
 * @param newValue The new value to replace the old element.
 * @return The modified tuple with the element replaced.
 *
 * Note: You must not change the original tuple, but instead return a new tuple.
 *
 * Example:
 * var accountant = Triple(5000.25, 9342, 3421.50)
 * val newTuple = modifyTuple(accountant, 1, 7000)
 * println(newTuple)  // Output: (5000.25, 7000, 3421.50)
 */
fun modifyTuple(accountant: Triple<Double, Int, Double>, index: Int, newValue: Any): Triple<Double, Int, Double> {

    val modifiedList = accountant.toList().mapIndexed { i, value ->
        if (i == index) newValue else value
    }
    return Triple(modifiedList[0] as Double, modifiedList[1] as Int, modifiedList[2] as Double)
}