ADVERTENCIA: ¡Este programa tiene un error, lo que significa que debemos corregirlo!
Los números enteros no están entre comillas. Las cadenas siempre deben estar entre comillas.
Hacer clic Ejecute y lea el mensaje de error. Solucione un error eliminando las comillas y el otro error agregando comillas para depurar el programa para que dibuje una estrella de color ciruela. Hacer clic Corre a ver tus cambios y Enviar y A continuación , cuando haya terminado.
To navigate the page using the TAB key, first press ESC to exit the code editor.
# sprite = codesters.Star(x, y, points, radius, "color")
sprite = codesters.Star(0, 0, 7, "100", plum)
t = codesters.Teacher()
try:
tval1 = sprite.get_color()
except:
tval1 = "DNE"
try:
params = t.get_parameters_for_function('Star')
tval2 = 0
for sublist in params:
tval2 += sublist.count('"100"')
except:
tval2 = "DNE"
tester = TestManager()
t1 = TestObjective()
t1.add_success(tval1 == "plum", "Great job debugging the program!")
t1.add_failure(tval1 == "DNE", "Did you delete the star?")
t1.add_creative(tval1 != "plum" and tval1 != "DNE", "That's a good color too!")
t2 = TestObjective()
t2.add_success(tval2 == 0, "Great job debugging the program!")
t2.add_failure(tval2 == 1, "Did you use an integer for the radius parameter?")
t2.add_failure(tval2 == "DNE", "Did you delete the star?")
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
Run Code
Activity Submitted!
Enviar Trabajo
Actividad Siguiente
Stop Running Code
Show Chart
Show Console
Reset Code Editor
Codesters How To (opens in a new tab)