/**
 * This exercise requires the Chef to create a range of numbers from the start to the stop parameter and
 * update the inventory accordingly.
 *
 * The Chef must modify the inventory list by adding the numbers from the range created, but only if the
 * number is not already in the inventory.
 *
 * Complete the code below to solve the exercise.
 */
fun updateInventory(start: Int, stop: Int): MutableList<Int> {

    val inventory = mutableListOf(1, 3, 5, 7, 9)
    
    // Convert the inventory into a set for easier comparison
    val inventorySet = inventory.toSet()
    
    // Create a range from start to stop parameter (inclusive)
    val rangeNumbers = (start..stop).toList()
    
    // Update the inventory by adding the numbers from the range,
    // but only if the number is not already in the inventory
    for (number in rangeNumbers) {
        if (number !in inventorySet) {
            inventory.add(number)
        }
    }
    
    return inventory
}
/**
 * This exercise requires the Chef to create a range of numbers from the start to the stop parameter and
 * update the inventory accordingly.
 *
 * The Chef must modify the inventory list by adding the numbers from the range created, but only if the
 * number is not already in the inventory.
 *
 * Complete the code below to solve the exercise.
 */
fun updateInventory(start: Int, stop: Int): MutableList<Int> {
/**
 * This exercise requires the Chef to create a range of numbers from the start to the stop parameter and
 * update the inventory accordingly.
 *
 * The Chef must modify the inventory list by adding the numbers from the range created, but only if the
 * number is not already in the inventory.
 *
 * Complete the code below to solve the exercise.
 */
fun updateInventory(start: Int, stop: Int): MutableList<Int> {

    val inventory = mutableListOf(1, 3, 5, 7, 9)
    
    // Convert the inventory into a set for easier comparison
    val inventorySet = inventory.toSet()
    
    // Create a range from start to stop parameter (inclusive)
    val rangeNumbers = (start..stop).toList()
    
    // Update the inventory by adding the numbers from the range,
    // but only if the number is not already in the inventory
    for (number in rangeNumbers) {
        if (number !in inventorySet) {
            inventory.add(number)
        }
    }
    
    return inventory
}