PASO 6: Ahora vamos a aprender cómo controlamos partes específicas de los comandos en nuestro programa.
Un parámetro es un valor en un comando que controla cómo se ejecuta el comando. Un parámetro es el string que acabas de cambiar. Los otros parámetros controlan la ubicación y el color del texto. Puedes utilizar el comentario como guía.
Cambia la coordenada x a 0 y la coordenada y a -200. Cambia el color a "blue".
To navigate the page using the TAB key, first press ESC to exit the code editor.
stage.set_background("park")
sprite = codesters.Sprite("person3")
sprite.glide_to(-100, 50)
# sprite = codesters.Text("text", x, y, "color")
text = codesters.Text("I went to the park!", 100, 200, "red")
t = codesters.Teacher()
txt_func = t.get_parameters_for_function('Text')
try:
tval2 = int(txt_func[0][1])
except:
tval2 = "DNE"
try:
tval3 = int(txt_func[0][2])
except:
tval3 = "DNE"
try:
tval4 = txt_func[0][3]
except:
tval4 = "DNE"
t1 = TestObjective()
t1.add_success(tval2 == 0 and tval3 == -200, "Great job!")
t1.add_failure(tval2 == "DNE", "Oops! Did you delete the Text in Color command?")
t1.add_failure(tval3 == "DNE", "Oops! Did you delete the Text in Color command?")
t1.add_failure(tval2 == 100, "Did you change the x coordinate?")
t1.add_failure(tval3 == 200, "Did you change the y-coordinate?")
t1.add_creative(tval2 != 0 and tval2 != 100 and tval2 != "DNE", "That's a good place for text, too!")
t1.add_creative(tval3 != -200 and tval3 != 200 and tval3 != "DNE", "That's a good pace for text, too!")
t2 = TestObjective()
t2.add_success("blue" in tval4, "Great job!")
t2.add_failure(tval4 == "DNE", "Oops! Did you delete the Text in Color command?")
t2.add_failure('red' in tval4, "Did you change the text color?")
t2.add_creative('blue' not in tval4 and 'red' not in tval4 and tval4 != "DNE", "That's a good color, too!")
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.