/**
 * Given a list of numbers, divide the element at the specified index by the divisor.
 * Replace the element at the specified index with the result of the division.
 *
 * @param numbers A list of numbers
 * @param index Index of the element to be divided and replaced
 * @param divisor Number to divide the element by
 * @return The modified list of numbers
 *
 * Example:
 * Input:
 * numbers = [10, 20, 30, 40]
 * index = 2
 * divisor = 5
 *
 * Output:
 * [10, 20, 6.0, 40]
 */
fun divideElements(numbers: MutableList<Double>, index: Int, divisor: Double): List<Double> {

    try {
        numbers[index] /= divisor
    } catch (e: IndexOutOfBoundsException) {
        println("Index out of range!")
    }
    
    return numbers
}
/**
 * Given a list of numbers, divide the element at the specified index by the divisor.
 * Replace the element at the specified index with the result of the division.
 *
 * @param numbers A list of numbers
 * @param index Index of the element to be divided and replaced
 * @param divisor Number to divide the element by
 * @return The modified list of numbers
 *
 * Example:
 * Input:
 * numbers = [10, 20, 30, 40]
 * index = 2
 * divisor = 5
 *
 * Output:
 * [10, 20, 6.0, 40]
 */
fun divideElements(numbers: MutableList<Double>, index: Int, divisor: Double): List<Double> {
/**
 * Given a list of numbers, divide the element at the specified index by the divisor.
 * Replace the element at the specified index with the result of the division.
 *
 * @param numbers A list of numbers
 * @param index Index of the element to be divided and replaced
 * @param divisor Number to divide the element by
 * @return The modified list of numbers
 *
 * Example:
 * Input:
 * numbers = [10, 20, 30, 40]
 * index = 2
 * divisor = 5
 *
 * Output:
 * [10, 20, 6.0, 40]
 */
fun divideElements(numbers: MutableList<Double>, index: Int, divisor: Double): List<Double> {

    try {
        numbers[index] /= divisor
    } catch (e: IndexOutOfBoundsException) {
        println("Index out of range!")
    }
    
    return numbers
}