/**
 * This exercise involves an astronomer who wants to modify the distances of stars in a given list
 * by multiplying them with a factor.
 *
 * The function takes in two arguments:
 * - starDistances: a list of distances to different stars
 * - factor: a number to multiply the distances by
 *
 * The function should multiply each element in the list by the given factor and return the updated list.
 *
 * Example:
 * starDistances = [10, 20, 30, 40, 50]
 * factor = 2
 *
 * Output:
 * [20, 40, 60, 80, 100]
 */
fun multiplyDistance(starDistances: MutableList<Int>, factor: Int): List<Int> {

    // Use a loop to iterate over each element in the starDistances list
    for (i in starDistances.indices) {
        // Multiply each distance by the given factor
        starDistances[i] *= factor
    }
    return starDistances
}

// Example usage
/**
 * This exercise involves an astronomer who wants to modify the distances of stars in a given list
 * by multiplying them with a factor.
 *
 * The function takes in two arguments:
 * - starDistances: a list of distances to different stars
 * - factor: a number to multiply the distances by
 *
 * The function should multiply each element in the list by the given factor and return the updated list.
 *
 * Example:
 * starDistances = [10, 20, 30, 40, 50]
 * factor = 2
 *
 * Output:
 * [20, 40, 60, 80, 100]
 */
fun multiplyDistance(starDistances: MutableList<Int>, factor: Int): List<Int> {
/**
 * This exercise involves an astronomer who wants to modify the distances of stars in a given list
 * by multiplying them with a factor.
 *
 * The function takes in two arguments:
 * - starDistances: a list of distances to different stars
 * - factor: a number to multiply the distances by
 *
 * The function should multiply each element in the list by the given factor and return the updated list.
 *
 * Example:
 * starDistances = [10, 20, 30, 40, 50]
 * factor = 2
 *
 * Output:
 * [20, 40, 60, 80, 100]
 */
fun multiplyDistance(starDistances: MutableList<Int>, factor: Int): List<Int> {

    // Use a loop to iterate over each element in the starDistances list
    for (i in starDistances.indices) {
        // Multiply each distance by the given factor
        starDistances[i] *= factor
    }
    return starDistances
}

// Example usage