stage.set_background("park")
sprite = codesters.Sprite("person3")
sprite.glide_to(-100, 50)
# text = codesters.Text("text", x, y, "color")
text = codesters.Text("I went to the park!", 0, -200, "blue")
stage.wait(1)
sprite.move_right(400)
transition1 = sprite.ask("Choose a transition from the sequence category.")
text.set_text(transition1)
t = codesters.Teacher()
try:
params = t.find_function('set_text')
tval1 = params[1][1].lower()
except:
tval1 = "DNE"
try:
params2 = t.find_function('wait')
tval2 = params2[1][1]
except:
tval2 = "DNE"
try:
params3 = t.find_function("set_background")
tval3 = params3[1][1]
except:
tval3 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 != "DNE" and "hello codesters" not in tval1, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add a Set Text command?")
t1.add_failure("hello codesters" in tval1, "Did you change the text to describe your new scene?")
t2 = TestObjective()
t2.add_success(tval2 != "DNE", "Great job!")
t2.add_failure(tval2 == "DNE", "Did you add a Wait command?")
t3 = TestObjective()
t3.add_success(tval3 != "DNE", "Great job!")
t3.add_failure(tval3 == "DNE", "Did you add a set background command?")
tester = TestManager()
tester.add_test_list([t3, 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)