stage.set_background("underwater")
sprite = codesters.Sprite("fish")
sprite.move_down(150)
stage.wait(2)
sprite.turn_right(360)
def click(sprite):
sprite.say("Hello, Codester")
sprite.event_click(click)
t = codesters.Teacher()
params = t.find_function('set_x_speed')
click_params = t.find_function('event_click')
try:
tval1 = int(params[0][0])
tval1a = t.get_indent_at_line(tval1)
tval2 = int(click_params[0][0])
except:
tval1 = "DNE"
tval1a = "DNE"
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 != "DNE" and tval1a == 4, "Great Job! Be sure to click on your sprite!")
t1.add_failure(tval1 == "DNE", "Did you add the Set x Speed command?")
t1.add_failure(tval1 > tval2, "Did you put your Set x Speed command INSIDE your click event?")
t1.add_failure(tval1a == 0, "Did you indent your Set x Speed command?")
t1.add_failure(tval1a > 4, "I think you indented the command too much.")
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)