/**
 * Given two lists, this function appends all elements in list2 to the end of list1 using the plus assignment operator.
 * Returns the modified list1.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return the modified list1 with elements from list2 appended to it
 *
 * Example:
 * val list1 = mutableListOf(1, 2, 3)
 * val list2 = listOf(4, 5, 6)
 * appendElementsToList(list1, list2)
 * Output: [1, 2, 3, 4, 5, 6]
 */
fun appendElementsToList(list1: MutableList<Int>, list2: List<Int>): MutableList<Int> {

    for (element in list2) {
        list1 += element
    }
    return list1
}
/**
 * Given two lists, this function appends all elements in list2 to the end of list1 using the plus assignment operator.
 * Returns the modified list1.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return the modified list1 with elements from list2 appended to it
 *
 * Example:
 * val list1 = mutableListOf(1, 2, 3)
 * val list2 = listOf(4, 5, 6)
 * appendElementsToList(list1, list2)
 * Output: [1, 2, 3, 4, 5, 6]
 */
fun appendElementsToList(list1: MutableList<Int>, list2: List<Int>): MutableList<Int> {
/**
 * Given two lists, this function appends all elements in list2 to the end of list1 using the plus assignment operator.
 * Returns the modified list1.
 *
 * @param list1 the first list
 * @param list2 the second list
 * @return the modified list1 with elements from list2 appended to it
 *
 * Example:
 * val list1 = mutableListOf(1, 2, 3)
 * val list2 = listOf(4, 5, 6)
 * appendElementsToList(list1, list2)
 * Output: [1, 2, 3, 4, 5, 6]
 */
fun appendElementsToList(list1: MutableList<Int>, list2: List<Int>): MutableList<Int> {

    for (element in list2) {
        list1 += element
    }
    return list1
}