/**
 * This function takes a list of astronomers and a list of galaxies.
 * It appends the astronomer's name and the galaxies they study to the list,
 * and then iterates over the list to display the appended elements.
 */
fun appendElementsAndIterate(astronomerList: MutableList<String>, galaxies: List<String>) {

    require(astronomerList.size == galaxies.size) { "Lists must have the same size" }

    // Append astronomer names and galaxies to the list
    for (i in astronomerList.indices) {
        astronomerList.add(astronomerList[i])
        astronomerList.add(galaxies[i])
    }

    // Iterate over the list to display the appended elements
    for (i in 0 until astronomerList.size step 2) {
        println("Astronomer: ${astronomerList[i]} studies ${astronomerList[i + 1]}")
    }
}
/**
 * This function takes a list of astronomers and a list of galaxies.
 * It appends the astronomer's name and the galaxies they study to the list,
 * and then iterates over the list to display the appended elements.
 */
fun appendElementsAndIterate(astronomerList: MutableList<String>, galaxies: List<String>) {
/**
 * This function takes a list of astronomers and a list of galaxies.
 * It appends the astronomer's name and the galaxies they study to the list,
 * and then iterates over the list to display the appended elements.
 */
fun appendElementsAndIterate(astronomerList: MutableList<String>, galaxies: List<String>) {

    require(astronomerList.size == galaxies.size) { "Lists must have the same size" }

    // Append astronomer names and galaxies to the list
    for (i in astronomerList.indices) {
        astronomerList.add(astronomerList[i])
        astronomerList.add(galaxies[i])
    }

    // Iterate over the list to display the appended elements
    for (i in 0 until astronomerList.size step 2) {
        println("Astronomer: ${astronomerList[i]} studies ${astronomerList[i + 1]}")
    }
}