Explore what CodeHS has to offer for districts, schools, and teachers.
Click on one of our programs below to get started coding in the sandbox!
View All
Which of the following code blocks will print all the elements of a list shoppingList?
shoppingList
i = 1 REPEAT LENGTH(shoppingList) TIMES { DISPLAY(shoppingList[i]) i = i + 1 }
i = 1 REPEAT LENGTH(shoppingList) TIMES { DISPLAY(shoppingList[i - 1]) i = i + 1 }
i = 1 REPEAT LENGTH(shoppingList) - 1 TIMES { DISPLAY(shoppingList[i]) i = i + 1 }
i = 1 REPEAT LENGTH(shoppingList) + 1 TIMES { DISPLAY(shoppingList[i]) i = i + 1 }