/**
 * Given a list [lst] and an index [index], the function returns the absolute value of the element at that index.
 *
 * @param lst A list of integers.
 * @param index The index of the element.
 * @return The absolute value of the element at the specified index.
 *
 * Example:
 * getAbsoluteValueAtIndex(listOf(4, -7, 2, -9, 5), 2) // 2
 * getAbsoluteValueAtIndex(listOf(3, -5, 1, -8, 6), 4) // 6
 */
fun getAbsoluteValueAtIndex(lst: List<Int>, index: Int): Int? {

    return try {
        Math.abs(lst[index])
    } catch (e: IndexOutOfBoundsException) {
        println("Index is out of range.")
        null
    } catch (e: ClassCastException) {
        println("List must contain integers only.")
        null
    }
}
/**
 * Given a list [lst] and an index [index], the function returns the absolute value of the element at that index.
 *
 * @param lst A list of integers.
 * @param index The index of the element.
 * @return The absolute value of the element at the specified index.
 *
 * Example:
 * getAbsoluteValueAtIndex(listOf(4, -7, 2, -9, 5), 2) // 2
 * getAbsoluteValueAtIndex(listOf(3, -5, 1, -8, 6), 4) // 6
 */
fun getAbsoluteValueAtIndex(lst: List<Int>, index: Int): Int? {
/**
 * Given a list [lst] and an index [index], the function returns the absolute value of the element at that index.
 *
 * @param lst A list of integers.
 * @param index The index of the element.
 * @return The absolute value of the element at the specified index.
 *
 * Example:
 * getAbsoluteValueAtIndex(listOf(4, -7, 2, -9, 5), 2) // 2
 * getAbsoluteValueAtIndex(listOf(3, -5, 1, -8, 6), 4) // 6
 */
fun getAbsoluteValueAtIndex(lst: List<Int>, index: Int): Int? {

    return try {
        Math.abs(lst[index])
    } catch (e: IndexOutOfBoundsException) {
        println("Index is out of range.")
        null
    } catch (e: ClassCastException) {
        println("List must contain integers only.")
        null
    }
}