/**
 * As a Marketing Manager, you have a list of elements and you need to append a certain amount of elements to it.
 * Your task is to write a function that appends the given amount of elements to the existing list.
 *
 * @param amount An integer representing the number of elements to be appended.
 * @param elements A list containing the existing elements.
 * @return The modified 'elements' list after appending the given amount of elements.
 */
fun appendElements(amount: Int, elements: MutableList<String>): List<String> {

    if (amount <= 0) {
        return listOf("Invalid amount")
    }

    if (elements !is MutableList) {
        return listOf("Invalid elements")
    }

    for (i in 1..amount) {
        println("Enter an element to append:")
        val newElement = readLine() ?: ""
        elements.add(newElement)
    }

    return elements
}
/**
 * As a Marketing Manager, you have a list of elements and you need to append a certain amount of elements to it.
 * Your task is to write a function that appends the given amount of elements to the existing list.
 *
 * @param amount An integer representing the number of elements to be appended.
 * @param elements A list containing the existing elements.
 * @return The modified 'elements' list after appending the given amount of elements.
 */
fun appendElements(amount: Int, elements: MutableList<String>): List<String> {
/**
 * As a Marketing Manager, you have a list of elements and you need to append a certain amount of elements to it.
 * Your task is to write a function that appends the given amount of elements to the existing list.
 *
 * @param amount An integer representing the number of elements to be appended.
 * @param elements A list containing the existing elements.
 * @return The modified 'elements' list after appending the given amount of elements.
 */
fun appendElements(amount: Int, elements: MutableList<String>): List<String> {

    if (amount <= 0) {
        return listOf("Invalid amount")
    }

    if (elements !is MutableList) {
        return listOf("Invalid elements")
    }

    for (i in 1..amount) {
        println("Enter an element to append:")
        val newElement = readLine() ?: ""
        elements.add(newElement)
    }

    return elements
}