/**
 * A farmer wants to update their inventory with items from their shopping list.
 * Implement the farmer function that takes a shopping list and an inventory list as input.
 * The function should compare the items in the shopping list with the items in the inventory.
 * If an item is already present in the inventory, it should be removed from the shopping list.
 *
 * @param shoppingList A list of items to be purchased.
 * @param inventory A list of items already present in the farmer's inventory.
 * @return The updated shopping list after removing items that are already in the inventory.
 */
fun farmer(shoppingList: MutableList<String>, inventory: List<String>): MutableList<String> {

    val iterator = shoppingList.iterator()
    while (iterator.hasNext()) {
        val item = iterator.next()
        if (inventory.contains(item)) {
            iterator.remove()
        }
    }
    return shoppingList
}
/**
 * A farmer wants to update their inventory with items from their shopping list.
 * Implement the farmer function that takes a shopping list and an inventory list as input.
 * The function should compare the items in the shopping list with the items in the inventory.
 * If an item is already present in the inventory, it should be removed from the shopping list.
 *
 * @param shoppingList A list of items to be purchased.
 * @param inventory A list of items already present in the farmer's inventory.
 * @return The updated shopping list after removing items that are already in the inventory.
 */
fun farmer(shoppingList: MutableList<String>, inventory: List<String>): MutableList<String> {
/**
 * A farmer wants to update their inventory with items from their shopping list.
 * Implement the farmer function that takes a shopping list and an inventory list as input.
 * The function should compare the items in the shopping list with the items in the inventory.
 * If an item is already present in the inventory, it should be removed from the shopping list.
 *
 * @param shoppingList A list of items to be purchased.
 * @param inventory A list of items already present in the farmer's inventory.
 * @return The updated shopping list after removing items that are already in the inventory.
 */
fun farmer(shoppingList: MutableList<String>, inventory: List<String>): MutableList<String> {

    val iterator = shoppingList.iterator()
    while (iterator.hasNext()) {
        val item = iterator.next()
        if (inventory.contains(item)) {
            iterator.remove()
        }
    }
    return shoppingList
}