/**
 * This function takes a library inventory list and a book title as input.
 * It appends the book title to the inventory list and modifies the last element using slicing.
 *
 * Task:
 * - Append the bookTitle to the libraryInventory list.
 * - Modify the last element of libraryInventory by replacing the last letter with a random uppercase letter.
 *
 * @param libraryInventory A list containing the inventory of books in the library.
 * @param bookTitle The title of the book to be appended to the inventory.
 * @return Updated library inventory list.
 */
import kotlin.random.Random


fun librarianTasks(libraryInventory: MutableList<String>, bookTitle: String): List<String> {

    // Append the bookTitle to the libraryInventory list
    libraryInventory.add(bookTitle)

    // Modify the last element of libraryInventory using slicing
    libraryInventory[libraryInventory.size - 1] = libraryInventory.last().dropLast(1) + ('A'..'Z').random()

    return libraryInventory
}

// Example usage
import kotlin.random.Random

/**
 * This function takes a library inventory list and a book title as input.
 * It appends the book title to the inventory list and modifies the last element using slicing.
 *
 * Task:
 * - Append the bookTitle to the libraryInventory list.
 * - Modify the last element of libraryInventory by replacing the last letter with a random uppercase letter.
 *
 * @param libraryInventory A list containing the inventory of books in the library.
 * @param bookTitle The title of the book to be appended to the inventory.
 * @return Updated library inventory list.
 */
fun librarianTasks(libraryInventory: MutableList<String>, bookTitle: String): List<String> {
import kotlin.random.Random

/**
 * This function takes a library inventory list and a book title as input.
 * It appends the book title to the inventory list and modifies the last element using slicing.
 *
 * Task:
 * - Append the bookTitle to the libraryInventory list.
 * - Modify the last element of libraryInventory by replacing the last letter with a random uppercase letter.
 *
 * @param libraryInventory A list containing the inventory of books in the library.
 * @param bookTitle The title of the book to be appended to the inventory.
 * @return Updated library inventory list.
 */
fun librarianTasks(libraryInventory: MutableList<String>, bookTitle: String): List<String> {

    // Append the bookTitle to the libraryInventory list
    libraryInventory.add(bookTitle)

    // Modify the last element of libraryInventory using slicing
    libraryInventory[libraryInventory.size - 1] = libraryInventory.last().dropLast(1) + ('A'..'Z').random()

    return libraryInventory
}

// Example usage