Activity: Debugging 2

WARNING: This program has a bug. This bug is a logic error: our code runs, but it doesn't do what we intended!

RULE: The first item in a list is at index 0.

  • Click Run and watch the stage to see what's wrong.
  • The sprite says the second class in the list, but it should say the first (which is coding!).
  • Debug the program so that the sprite says the first class of the day using the correct index.

student= codesters.Sprite("person13") class_list = ["coding", "history", "math", "science", "english"] first_class = class_list[1] student.say("My first class of the day is " + first_class)
Support