/**
 * This exercise is designed for a zoologist to find the common animal species between two different habitats: the forest and the savannah. The zoologist needs to use the range function to create a range of indices to iterate through the animal lists and find the common species.
 *
 * @param forestAnimals a list of animal species found in the forest habitat
 * @param savannahAnimals a list of animal species found in the savannah habitat
 *
 * @return a list of the common animal species found in both habitats
 */
fun findCommonSpecies(forestAnimals: List<String>, savannahAnimals: List<String>): List<String> {

    val commonSpecies = mutableListOf<String>()

    for (i in 0 until minOf(forestAnimals.size, savannahAnimals.size)) {
        if (forestAnimals[i] == savannahAnimals[i]) {
            commonSpecies.add(forestAnimals[i])
        }
    }

    return commonSpecies
}
/**
 * This exercise is designed for a zoologist to find the common animal species between two different habitats: the forest and the savannah. The zoologist needs to use the range function to create a range of indices to iterate through the animal lists and find the common species.
 *
 * @param forestAnimals a list of animal species found in the forest habitat
 * @param savannahAnimals a list of animal species found in the savannah habitat
 *
 * @return a list of the common animal species found in both habitats
 */
fun findCommonSpecies(forestAnimals: List<String>, savannahAnimals: List<String>): List<String> {
/**
 * This exercise is designed for a zoologist to find the common animal species between two different habitats: the forest and the savannah. The zoologist needs to use the range function to create a range of indices to iterate through the animal lists and find the common species.
 *
 * @param forestAnimals a list of animal species found in the forest habitat
 * @param savannahAnimals a list of animal species found in the savannah habitat
 *
 * @return a list of the common animal species found in both habitats
 */
fun findCommonSpecies(forestAnimals: List<String>, savannahAnimals: List<String>): List<String> {

    val commonSpecies = mutableListOf<String>()

    for (i in 0 until minOf(forestAnimals.size, savannahAnimals.size)) {
        if (forestAnimals[i] == savannahAnimals[i]) {
            commonSpecies.add(forestAnimals[i])
        }
    }

    return commonSpecies
}