stage.set_background("halfcourt")
sprite = codesters.Sprite("player4")
sprite.go_to(215, -175)
net = codesters.Sprite("basketballnet")
net.go_to(215, 175)
ball = codesters.Sprite("basketball")
x = random.randint(-100, 150)
ball.go_to(x, -25)
t = codesters.Teacher()
try:
tval1 = stage.get_gravity()
except:
tval1 = "DNE"
try:
tval2 = stage.get_bounce()
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == 10, "Great Job!")
t1.add_failure(tval1 == 0, "Did you set the gravity for the stage?")
t2 = TestObjective()
t2.add_success(tval2 == .8, "Great job!")
t2.add_failure(tval2 == 1, "Did you add a Set Bounce command?")
t2.add_creative(tval2 != .8 and tval2 != 1, "Creative choice!")
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)