stage.set_background("halfcourt")
sprite = codesters.Sprite("player1")
sprite.go_to(-175, -150)
net = codesters.Sprite("basketballnet")
t = codesters.Teacher()
gotos = t.get_parameters_for_function('go_to')
try:
tval1 = t.find_function('go_to')[1][1]
except:
tval1 = "DNE"
try:
tval2 = int(gotos[1][0])
tval3 = int(gotos[1][1])
except:
tval2 = "DNE"
tval3 = "DNE"
t1 = TestObjective()
t1.add_success('net.' in tval1 and tval2 == 215 and tval3 == 175, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add a Go To command?")
t1.add_failure('net.' not in tval1, "Did you change the name in front of your Go To command?")
t1.add_failure(tval2 < 215 and tval2 > -215, "Make sure your net lines up against of the stage walls!")
t1.add_failure(tval2 != 215 and tval2 != -215, "Did you change the x-coordinate in the Go To command to 215?")
t1.add_failure(tval3 > 175, "That net might be too high! Try a lower y-value.")
t1.add_creative(tval3 < 175, "That's a low net! Creative choice!")
t1.add_failure(tval3 != 175, "Did you change the y-coordinate in the Go To command to 175?")
tester = TestManager()
tester.add_test_list([t1])
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)