/**
 * The function takes in a list of floating-point numbers, an index, and a value.
 * It modifies the element at the given index in the list and returns the modified list.
 *
 * @param array A list of floating-point numbers
 * @param index An integer representing the index of the element to modify
 * @param value A floating-point number to replace the element at the given index
 * @return Modified list with the updated element
 *
 * Example:
 * array = [1.2, 3.4, 5.6]
 * index = 1
 * value = 9.8
 * modifyArrayElements(array, index, value) => [1.2, 9.8, 5.6]
 */
fun modifyArrayElements(array: MutableList<Double>, index: Int, value: Double): List<Double> {

    if (index < 0 || index >= array.size) {
        throw IllegalArgumentException("Invalid index")
    }
    if (value !is Double) {
        throw IllegalArgumentException("The value must be a floating-point number")
    }

    val modifiedArray = array.toMutableList()
    modifiedArray[index] = value
    return modifiedArray
}
/**
 * The function takes in a list of floating-point numbers, an index, and a value.
 * It modifies the element at the given index in the list and returns the modified list.
 *
 * @param array A list of floating-point numbers
 * @param index An integer representing the index of the element to modify
 * @param value A floating-point number to replace the element at the given index
 * @return Modified list with the updated element
 *
 * Example:
 * array = [1.2, 3.4, 5.6]
 * index = 1
 * value = 9.8
 * modifyArrayElements(array, index, value) => [1.2, 9.8, 5.6]
 */
fun modifyArrayElements(array: MutableList<Double>, index: Int, value: Double): List<Double> {
/**
 * The function takes in a list of floating-point numbers, an index, and a value.
 * It modifies the element at the given index in the list and returns the modified list.
 *
 * @param array A list of floating-point numbers
 * @param index An integer representing the index of the element to modify
 * @param value A floating-point number to replace the element at the given index
 * @return Modified list with the updated element
 *
 * Example:
 * array = [1.2, 3.4, 5.6]
 * index = 1
 * value = 9.8
 * modifyArrayElements(array, index, value) => [1.2, 9.8, 5.6]
 */
fun modifyArrayElements(array: MutableList<Double>, index: Int, value: Double): List<Double> {

    if (index < 0 || index >= array.size) {
        throw IllegalArgumentException("Invalid index")
    }
    if (value !is Double) {
        throw IllegalArgumentException("The value must be a floating-point number")
    }

    val modifiedArray = array.toMutableList()
    modifiedArray[index] = value
    return modifiedArray
}