stage.set_background("moon")
sprite = codesters.Sprite("hedgehog", 0, -210)
t = codesters.Teacher()
try:
tval1 = score
except:
tval1 = "DNE"
try:
tval2 = score_display.get_name()
tval3 = score_display.get_x()
tval4 = score_display.get_y()
except:
tval2 = "DNE"
tval3 = "DNE"
tval4 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == 0, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you create an integer variable and name it score?")
t1.add_failure(tval1 != 0 and tval1 != "DNE", "Did you set score's value to 0?")
t2 = TestObjective()
t2.add_success(tval2 == "score" and tval3 == -210 and tval4 == -210, "Great job!")
t2.add_failure(tval2 == "DNE", "Did you add a Variable Display and name it score_display?")
t2.add_failure(tval2 != "score", "Are you displaying score on the stage?")
t2.add_failure(tval3 != -210 and tval4 != -210, "Did you change the displays's xy-coordinates?")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)