/**
 * This exercise aims to test your understanding of sequential statements and modifying elements using list methods.
 *
 * You are given a list 'lst' and a number 'num'. Your task is to modify the list by performing the following operations:
 * 1. Remove all odd numbers from the list.
 * 2. Multiply each even number in the list by 'num'.
 * 3. Reverse the updated list.
 *
 * @param lst The initial list.
 * @param num The number to multiply even elements by.
 * @return The final modified list.
 *
 * For example:
 * modifyList(listOf(1, 2, 3, 4, 5, 6), 3) should return [18, 12].
 */
fun modifyList(lst: List<Int>, num: Int): List<Int> {

    // Remove odd numbers from the list
    var modifiedList = lst.filter { it % 2 == 0 }

    // Multiply even numbers by 'num'
    modifiedList = modifiedList.map { if (it % 2 == 0) it * num else it }

    // Reverse the updated list
    modifiedList = modifiedList.reversed()

    return modifiedList
}
/**
 * This exercise aims to test your understanding of sequential statements and modifying elements using list methods.
 *
 * You are given a list 'lst' and a number 'num'. Your task is to modify the list by performing the following operations:
 * 1. Remove all odd numbers from the list.
 * 2. Multiply each even number in the list by 'num'.
 * 3. Reverse the updated list.
 *
 * @param lst The initial list.
 * @param num The number to multiply even elements by.
 * @return The final modified list.
 *
 * For example:
 * modifyList(listOf(1, 2, 3, 4, 5, 6), 3) should return [18, 12].
 */
fun modifyList(lst: List<Int>, num: Int): List<Int> {
/**
 * This exercise aims to test your understanding of sequential statements and modifying elements using list methods.
 *
 * You are given a list 'lst' and a number 'num'. Your task is to modify the list by performing the following operations:
 * 1. Remove all odd numbers from the list.
 * 2. Multiply each even number in the list by 'num'.
 * 3. Reverse the updated list.
 *
 * @param lst The initial list.
 * @param num The number to multiply even elements by.
 * @return The final modified list.
 *
 * For example:
 * modifyList(listOf(1, 2, 3, 4, 5, 6), 3) should return [18, 12].
 */
fun modifyList(lst: List<Int>, num: Int): List<Int> {

    // Remove odd numbers from the list
    var modifiedList = lst.filter { it % 2 == 0 }

    // Multiply even numbers by 'num'
    modifiedList = modifiedList.map { if (it % 2 == 0) it * num else it }

    // Reverse the updated list
    modifiedList = modifiedList.reversed()

    return modifiedList
}