/**
 * This exercise focuses on the advantages of appending and removing elements for an athlete.
 *
 * Given a list of athletes, the function should perform the following tasks:
 * 1. Append a new athlete to the list.
 * 2. Remove the athlete with the lowest score from the list.
 * 3. Return the final list of athletes.
 *
 * @param athleteList A list of athletes
 * @return The modified list of athletes
 */
fun appendRemoveElements(athleteList: MutableList<Map<String, Any>>): MutableList<Map<String, Any>> {

    // Append a new athlete to the list
    athleteList.add(mapOf("name" to "New Athlete", "score" to 0))
    
    // Find the athlete with the lowest score
    val lowestScoreAthlete = athleteList.minByOrNull { it["score"] as Int }
    
    // Remove the athlete with the lowest score from the list
    athleteList.remove(lowestScoreAthlete)
    
    return athleteList
}
/**
 * This exercise focuses on the advantages of appending and removing elements for an athlete.
 *
 * Given a list of athletes, the function should perform the following tasks:
 * 1. Append a new athlete to the list.
 * 2. Remove the athlete with the lowest score from the list.
 * 3. Return the final list of athletes.
 *
 * @param athleteList A list of athletes
 * @return The modified list of athletes
 */
fun appendRemoveElements(athleteList: MutableList<Map<String, Any>>): MutableList<Map<String, Any>> {
/**
 * This exercise focuses on the advantages of appending and removing elements for an athlete.
 *
 * Given a list of athletes, the function should perform the following tasks:
 * 1. Append a new athlete to the list.
 * 2. Remove the athlete with the lowest score from the list.
 * 3. Return the final list of athletes.
 *
 * @param athleteList A list of athletes
 * @return The modified list of athletes
 */
fun appendRemoveElements(athleteList: MutableList<Map<String, Any>>): MutableList<Map<String, Any>> {

    // Append a new athlete to the list
    athleteList.add(mapOf("name" to "New Athlete", "score" to 0))
    
    // Find the athlete with the lowest score
    val lowestScoreAthlete = athleteList.minByOrNull { it["score"] as Int }
    
    // Remove the athlete with the lowest score from the list
    athleteList.remove(lowestScoreAthlete)
    
    return athleteList
}