/**
 * This exercise focuses on appending elements to a list and adding numbers.
 *
 * Your task is to complete the code by appending the given number to the lawyerList and then
 * adding up all the elements in the list, returning the final result.
 *
 * @param lawyerList A list of numbers.
 * @param number A number to be appended to the list.
 * @return The sum of all the elements in the lawyerList after appending the given number.
 *
 * Example:
 * appendAndAddElements(listOf(1, 2, 3), 4)
 * Output: 10
 *
 * Note:
 * The function should return the sum of [1, 2, 3, 4] which is 10.
 */
fun appendAndAddElements(lawyerList: MutableList<Int>, number: Int): Int {

    // Append the given number to the lawyerList
    lawyerList.add(number)

    // Sum all the elements in the lawyerList
    var result = 0
    for (element in lawyerList) {
        result += element
    }

    return result
}
/**
 * This exercise focuses on appending elements to a list and adding numbers.
 *
 * Your task is to complete the code by appending the given number to the lawyerList and then
 * adding up all the elements in the list, returning the final result.
 *
 * @param lawyerList A list of numbers.
 * @param number A number to be appended to the list.
 * @return The sum of all the elements in the lawyerList after appending the given number.
 *
 * Example:
 * appendAndAddElements(listOf(1, 2, 3), 4)
 * Output: 10
 *
 * Note:
 * The function should return the sum of [1, 2, 3, 4] which is 10.
 */
fun appendAndAddElements(lawyerList: MutableList<Int>, number: Int): Int {
/**
 * This exercise focuses on appending elements to a list and adding numbers.
 *
 * Your task is to complete the code by appending the given number to the lawyerList and then
 * adding up all the elements in the list, returning the final result.
 *
 * @param lawyerList A list of numbers.
 * @param number A number to be appended to the list.
 * @return The sum of all the elements in the lawyerList after appending the given number.
 *
 * Example:
 * appendAndAddElements(listOf(1, 2, 3), 4)
 * Output: 10
 *
 * Note:
 * The function should return the sum of [1, 2, 3, 4] which is 10.
 */
fun appendAndAddElements(lawyerList: MutableList<Int>, number: Int): Int {

    // Append the given number to the lawyerList
    lawyerList.add(number)

    // Sum all the elements in the lawyerList
    var result = 0
    for (element in lawyerList) {
        result += element
    }

    return result
}