Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
Create a function called processGroceries that takes a MutableList of grocery items, reverses the list, and prints each item's index and name, but only for items that don't start with the letter 'A'. Can you reorder the lines of code to solve this problem?For loop and lists
Grocery list's topsy-turvy adventure
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
groceries.reverse()
}
if (!item.startsWith('A')) {
println("$index: $item")
fun processGroceries(groceries: MutableList<String>) {
}
for ((index, item) in groceries.withIndex()) {
}
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.