ADVERTENCIA: Este programa tiene un error. Este error es un error lógico : nuestro código se ejecuta, ¡pero no hace lo que pretendíamos!
REGLA: El primer elemento de una lista está en el índice 0.
Hacer clicCorre y mira el escenario para ver qué está mal.
El sprite dice la segunda clase en la lista, pero debería decir la primera (¡que es codificación!).
Depura el programa para que el sprite diga la primera clase del día usando el índice correcto.
To navigate the page using the TAB key, first press ESC to exit the code editor.
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)
t = codesters.Teacher()
try:
tval1 = first_class
except:
tval1 = "DNE"
try:
tval2 = t.find_text('first_class')[0][1]
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == "coding", "Great job debugging the program!")
t1.add_failure(tval1 == "DNE", "Oops! Did you delete the list first_class?")
t1.add_failure(tval1 == "history", "Oops! That's the second class. Change the index to get to the first.")
t1.add_failure(tval1 == "math", "Oops! That's the third class. Change the index to get to the first.")
t1.add_failure(tval1 == "science", "Oops! That's the fourth class. Change the index to get to the first.")
t1.add_failure(tval1 == "english", "Oops! That's the fifth class. Change the index to get to the first.")
t2 = TestObjective()
t2.add_success('0' in tval2, "Great job debugging the program!")
t2.add_failure('0' not in tval2, "Change the index to get the sprite's first class.")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
Are you already running a Codesters project in another tab or window?
Micro:bit can only connect to one web page at a time.
Try stopping other Codesters projects or closing
other tabs or windows that may be using your Micro:bit.
If that doesn't fix the problem try disconnecting your Micro:bit,
reloading this page, and reconnecting your Micro:bit.