/**
 * This function takes two lists as input: 'books' and 'borrowedBooks'.
 * It returns a list of books that are currently available in the library.
 *
 * @param books A list of all books in the library
 * @param borrowedBooks A list of books that have been borrowed from the library
 * @return A list of available books in the library
 *
 * Task:
 * Write a code to find the available books by looping through the 'books' list and checking if each book
 * is present in the 'borrowedBooks' list. Use an alternative to the ternary operator to handle the condition
 * where a book is available or not.
 *
 * Difficulty: Difficult
 */
fun findAvailableBooks(books: List<String>, borrowedBooks: List<String>): List<String> {

    // Initialize an empty list to store the available books
    val availableBooks = mutableListOf<String>()

    // Loop through each book in the list of books
    for (book in books) {
        // If the book is not present in the list of borrowed books, add it to the availableBooks list
        if (book !in borrowedBooks) {
            availableBooks.add(book)
        }
    }

    return availableBooks
}
/**
 * This function takes two lists as input: 'books' and 'borrowedBooks'.
 * It returns a list of books that are currently available in the library.
 *
 * @param books A list of all books in the library
 * @param borrowedBooks A list of books that have been borrowed from the library
 * @return A list of available books in the library
 *
 * Task:
 * Write a code to find the available books by looping through the 'books' list and checking if each book
 * is present in the 'borrowedBooks' list. Use an alternative to the ternary operator to handle the condition
 * where a book is available or not.
 *
 * Difficulty: Difficult
 */
fun findAvailableBooks(books: List<String>, borrowedBooks: List<String>): List<String> {
/**
 * This function takes two lists as input: 'books' and 'borrowedBooks'.
 * It returns a list of books that are currently available in the library.
 *
 * @param books A list of all books in the library
 * @param borrowedBooks A list of books that have been borrowed from the library
 * @return A list of available books in the library
 *
 * Task:
 * Write a code to find the available books by looping through the 'books' list and checking if each book
 * is present in the 'borrowedBooks' list. Use an alternative to the ternary operator to handle the condition
 * where a book is available or not.
 *
 * Difficulty: Difficult
 */
fun findAvailableBooks(books: List<String>, borrowedBooks: List<String>): List<String> {

    // Initialize an empty list to store the available books
    val availableBooks = mutableListOf<String>()

    // Loop through each book in the list of books
    for (book in books) {
        // If the book is not present in the list of borrowed books, add it to the availableBooks list
        if (book !in borrowedBooks) {
            availableBooks.add(book)
        }
    }

    return availableBooks
}