Activity: Debugging 1

WARNING: This program has a syntax error, which means we need to fix it!

RULE: All list-index pairs must point to an item in a list. If an index is referenced but does not exist it is "out of range." Click Run and read the error message.

  • In this case we're trying to get the item at index 4 in menu_list, but menu_list's indexes range from 0 to 3.
  • Debug the program so that the sprite orders food using an index that is within the range.

customer = codesters.Sprite("person8") menu_list = ["hamburger", "nachos", "chicken", "turkey sandwich"] food_order = menu_list[4] customer.say("I'd like the " + food_order + " please!")