/**
 * As an electrician, sometimes you need to change lightbulbs. In this exercise,
 * you will write a function called 'changeLightbulb' that takes in a list of bulbs,
 * an index representing the position of the bulb you want to change, and a new bulb
 * to replace the old one. Your task is to replace the bulb at the given index with
 * the new bulb and return the updated list.
 *
 * @param bulbList A list of lightbulbs.
 * @param index An integer representing the position of the bulb to be changed.
 * @param newBulb A string representing the new bulb to replace the old one.
 * @return The updated list of lightbulbs with the desired bulb changed.
 */
fun changeLightbulb(bulbList: MutableList<String>, index: Int, newBulb: String): List<String> {

    bulbList[index] = newBulb  // Changing the bulb at the given index
    return bulbList
}

// Example usage
val bulbs = mutableListOf("incandescent", "led", "fluorescent", "halogen")
val index = 2
val newBulb = "neon"

val updatedBulbs = changeLightbulb(bulbs, index, newBulb)
/**
 * As an electrician, sometimes you need to change lightbulbs. In this exercise,
 * you will write a function called 'changeLightbulb' that takes in a list of bulbs,
 * an index representing the position of the bulb you want to change, and a new bulb
 * to replace the old one. Your task is to replace the bulb at the given index with
 * the new bulb and return the updated list.
 *
 * @param bulbList A list of lightbulbs.
 * @param index An integer representing the position of the bulb to be changed.
 * @param newBulb A string representing the new bulb to replace the old one.
 * @return The updated list of lightbulbs with the desired bulb changed.
 */
fun changeLightbulb(bulbList: MutableList<String>, index: Int, newBulb: String): List<String> {
/**
 * As an electrician, sometimes you need to change lightbulbs. In this exercise,
 * you will write a function called 'changeLightbulb' that takes in a list of bulbs,
 * an index representing the position of the bulb you want to change, and a new bulb
 * to replace the old one. Your task is to replace the bulb at the given index with
 * the new bulb and return the updated list.
 *
 * @param bulbList A list of lightbulbs.
 * @param index An integer representing the position of the bulb to be changed.
 * @param newBulb A string representing the new bulb to replace the old one.
 * @return The updated list of lightbulbs with the desired bulb changed.
 */
fun changeLightbulb(bulbList: MutableList<String>, index: Int, newBulb: String): List<String> {

    bulbList[index] = newBulb  // Changing the bulb at the given index
    return bulbList
}

// Example usage
val bulbs = mutableListOf("incandescent", "led", "fluorescent", "halogen")
val index = 2
val newBulb = "neon"

val updatedBulbs = changeLightbulb(bulbs, index, newBulb)