/**
 * This function receives a list of animals and their classifications
 * and records only the animals that have the classification "mammal".
 * If any animal classification is not "mammal", an error message is
 * displayed but the program keeps running.
 */
fun recordAnimals(animals: List<Pair<String, String>>): List<String> {

    val mammalAnimals = mutableListOf<String>()

    for (animal in animals) {
        try {
            if (animal.second == "mammal") {
                mammalAnimals.add(animal.first)
            }
        } catch (e: IndexOutOfBoundsException) {
            println("Error: Invalid animal record")
            continue
        }
    }

    return mammalAnimals
}
/**
 * This function receives a list of animals and their classifications
 * and records only the animals that have the classification "mammal".
 * If any animal classification is not "mammal", an error message is
 * displayed but the program keeps running.
 */
fun recordAnimals(animals: List<Pair<String, String>>): List<String> {
/**
 * This function receives a list of animals and their classifications
 * and records only the animals that have the classification "mammal".
 * If any animal classification is not "mammal", an error message is
 * displayed but the program keeps running.
 */
fun recordAnimals(animals: List<Pair<String, String>>): List<String> {

    val mammalAnimals = mutableListOf<String>()

    for (animal in animals) {
        try {
            if (animal.second == "mammal") {
                mammalAnimals.add(animal.first)
            }
        } catch (e: IndexOutOfBoundsException) {
            println("Error: Invalid animal record")
            continue
        }
    }

    return mammalAnimals
}