/**
 * This function modifies a specific element of a tuple at a given index.
 *
 * @param tup The input tuple.
 * @param index The index of the element to be modified.
 * @param newValue The new value to be assigned to the element at the given index.
 * @return The modified tuple.
 *
 * Example:
 * val tup = listOf(1, 2, 3, 4)
 * modifyTupleElements(tup, 2, "new") // [1, 2, "new", 4]
 */
fun modifyTupleElements(tup: List<Any>, index: Int, newValue: Any): List<Any> {

    // Convert the list to a mutable list to enable modification
    val modifiedTup = tup.toMutableList()

    // Modify the element at the given index with the new value
    modifiedTup[index] = newValue

    return modifiedTup
}
/**
 * This function modifies a specific element of a tuple at a given index.
 *
 * @param tup The input tuple.
 * @param index The index of the element to be modified.
 * @param newValue The new value to be assigned to the element at the given index.
 * @return The modified tuple.
 *
 * Example:
 * val tup = listOf(1, 2, 3, 4)
 * modifyTupleElements(tup, 2, "new") // [1, 2, "new", 4]
 */
fun modifyTupleElements(tup: List<Any>, index: Int, newValue: Any): List<Any> {
/**
 * This function modifies a specific element of a tuple at a given index.
 *
 * @param tup The input tuple.
 * @param index The index of the element to be modified.
 * @param newValue The new value to be assigned to the element at the given index.
 * @return The modified tuple.
 *
 * Example:
 * val tup = listOf(1, 2, 3, 4)
 * modifyTupleElements(tup, 2, "new") // [1, 2, "new", 4]
 */
fun modifyTupleElements(tup: List<Any>, index: Int, newValue: Any): List<Any> {

    // Convert the list to a mutable list to enable modification
    val modifiedTup = tup.toMutableList()

    // Modify the element at the given index with the new value
    modifiedTup[index] = newValue

    return modifiedTup
}