stage.set_background("winter")
sprite = codesters.Sprite("person12")
sprite.go_to(-125, -150)
frosty = codesters.Sprite("snowman")
frosty.go_to(100, -125)
snow = codesters.Sprite("snowflake3")
snow.go_to(100, 75)
greeting = codesters.Text("Happy Holidays!")
t = codesters.Teacher()
try:
tval1 = greeting.get_x()
tval1b = greeting.get_y()
except:
tval1 = "DNE"
tval1b = "DNE"
try:
tval2 = sprite.get_x()
tval2b = sprite.get_y()
except:
tval2 = "DNE"
tval2b = "DNE"
t1 = TestObjective()
# t1.add_success(tval1 == 0, "Great Job!")
t1.add_failure(tval2 == 0 and tval2b == 200 and tval1b != 200, "Make sure you change the name in front of your Go To command to snow.")
t1.add_failure(tval1 == -100, "Did you change the x-coordinate in the Go To command?")
t1.add_failure(tval1 == "DNE", "Did you delete or rename greeting?")
t1.add_default("Great job!", "success")
t2 = TestObjective()
t2.add_success(tval1b == 200, "Great job!")
t1.add_failure(tval2 == 0 and tval2b == 200 and tval1b != 200, "Make sure you change the name in front of your Go To command to snow.")
t2.add_failure(tval1b == -50, "Did you change the y-coordinate in the Go To command?")
t2.add_failure(tval1b == 0, "Did you add a Go To command to move the greeting?")
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)