/**
 * This exercise focuses on appending new elements to a list and applying it to a real-life scenario for a journalist.
 * The task is to append a new article to the existing list of articles written by the journalist.
 *
 * @param journalistArticles A list of articles written by the journalist.
 * @return The updated list of articles after appending a new article.
 */
fun appendNewElements(journalistArticles: MutableList<Map<String, String>>): MutableList<Map<String, String>> {

    // Get user input for the new article details
    print("Enter the title of the new article: ")
    val articleTitle = readLine() ?: ""
    print("Enter the category of the new article: ")
    val articleCategory = readLine() ?: ""
    print("Enter the content of the new article: ")
    val articleContent = readLine() ?: ""

    // Create a map for the new article
    val newArticle = mapOf(
        "title" to articleTitle,
        "category" to articleCategory,
        "content" to articleContent
    )

    // Append the new article to the list of journalist's articles
    journalistArticles.add(newArticle)

    return journalistArticles
}
/**
 * This exercise focuses on appending new elements to a list and applying it to a real-life scenario for a journalist.
 * The task is to append a new article to the existing list of articles written by the journalist.
 *
 * @param journalistArticles A list of articles written by the journalist.
 * @return The updated list of articles after appending a new article.
 */
fun appendNewElements(journalistArticles: MutableList<Map<String, String>>): MutableList<Map<String, String>> {
/**
 * This exercise focuses on appending new elements to a list and applying it to a real-life scenario for a journalist.
 * The task is to append a new article to the existing list of articles written by the journalist.
 *
 * @param journalistArticles A list of articles written by the journalist.
 * @return The updated list of articles after appending a new article.
 */
fun appendNewElements(journalistArticles: MutableList<Map<String, String>>): MutableList<Map<String, String>> {

    // Get user input for the new article details
    print("Enter the title of the new article: ")
    val articleTitle = readLine() ?: ""
    print("Enter the category of the new article: ")
    val articleCategory = readLine() ?: ""
    print("Enter the content of the new article: ")
    val articleContent = readLine() ?: ""

    // Create a map for the new article
    val newArticle = mapOf(
        "title" to articleTitle,
        "category" to articleCategory,
        "content" to articleContent
    )

    // Append the new article to the list of journalist's articles
    journalistArticles.add(newArticle)

    return journalistArticles
}