/**
 * A zoologist needs to iterate over a sequence of tuples, each containing the name and age of different animals.
 * The zoologist wants to unpack each tuple into separate variables and perform some operations on them.
 *
 * Complete the code below to iterate over the sequence of tuples, unpack the name and age into separate variables,
 * and print the name along with a statement whether the animal is young or old. If the age is less than 5, consider
 * the animal as young, otherwise consider it as old.
 *
 * Example:
 * animals = [("Lion", 3), ("Tiger", 6), ("Elephant", 2)]
 * Expected Output:
 * Lion is young
 * Tiger is old
 * Elephant is young
 *
 * @param animals A sequence of tuples where each tuple contains the name and age of an animal.
 */
fun iterateAndUnpack(animals: List<Pair<String, Int>>) {

    for (animal in animals) {
        // Unpack name and age from the tuple into separate variables below
        val (name, age) = animal
        // Complete the code below to check whether the animal is young or old, and print the appropriate statement
        val ageCategory = if (age < 5) "young" else "old"
        println("$name is $ageCategory")
    }
}
/**
 * A zoologist needs to iterate over a sequence of tuples, each containing the name and age of different animals.
 * The zoologist wants to unpack each tuple into separate variables and perform some operations on them.
 *
 * Complete the code below to iterate over the sequence of tuples, unpack the name and age into separate variables,
 * and print the name along with a statement whether the animal is young or old. If the age is less than 5, consider
 * the animal as young, otherwise consider it as old.
 *
 * Example:
 * animals = [("Lion", 3), ("Tiger", 6), ("Elephant", 2)]
 * Expected Output:
 * Lion is young
 * Tiger is old
 * Elephant is young
 *
 * @param animals A sequence of tuples where each tuple contains the name and age of an animal.
 */
fun iterateAndUnpack(animals: List<Pair<String, Int>>) {
/**
 * A zoologist needs to iterate over a sequence of tuples, each containing the name and age of different animals.
 * The zoologist wants to unpack each tuple into separate variables and perform some operations on them.
 *
 * Complete the code below to iterate over the sequence of tuples, unpack the name and age into separate variables,
 * and print the name along with a statement whether the animal is young or old. If the age is less than 5, consider
 * the animal as young, otherwise consider it as old.
 *
 * Example:
 * animals = [("Lion", 3), ("Tiger", 6), ("Elephant", 2)]
 * Expected Output:
 * Lion is young
 * Tiger is old
 * Elephant is young
 *
 * @param animals A sequence of tuples where each tuple contains the name and age of an animal.
 */
fun iterateAndUnpack(animals: List<Pair<String, Int>>) {

    for (animal in animals) {
        // Unpack name and age from the tuple into separate variables below
        val (name, age) = animal
        // Complete the code below to check whether the animal is young or old, and print the appropriate statement
        val ageCategory = if (age < 5) "young" else "old"
        println("$name is $ageCategory")
    }
}