bird_text = codesters.Text("Bird Sprite", -150, 70, "red")
cat_text = codesters.Text("Panther Sprite", 150, 70, "blue")
sprite = codesters.Sprite("toucan")
sprite = codesters.Sprite("panther")
sprite.glide_to(-150, -50)
sprite.glide_to(150, -50)
try:
tval1 = sam.get_x()
tval2 = sam.get_y()
tval3 = sam.get_image_name()
except:
tval1 = "DNE"
tval2 = "DNE"
tval3 = "DNE"
try:
tval4 = smokey.get_x()
tval5 = smokey.get_y()
tval6 = smokey.get_image_name()
except:
tval4 = "DNE"
tval5 = "DNE"
tval6 = "DNE"
t1 = TestObjective()
t1.add_success(tval3 == "toucan", "Great job debugging the program!")
t1.add_failure(tval3 == "DNE", 'Did you name the sprite with the "toucan" image sam?')
t1.add_failure(tval3 == "panther", 'Oops! Try renaming the sprite with the "toucan" image sam')
t2 = TestObjective()
t2.add_success(tval6 == "panther", "Great job debugging the program!")
t2.add_failure(tval6 == "DNE", 'Did you name the sprite with the "panther" image smokey?')
t2.add_failure(tval6 == "toucan", 'Oops! Try renaming the sprite with the "panther" image smokey')
t3 = TestObjective()
t3.add_success(tval1 == -150 and tval2 == -50, "Great job debugging the program!")
t3.add_failure(tval1 == 150 and tval2 == -50, "Oops! Try using sam's name in the first glide to command.")
t3.add_failure(tval1 != -150 or tval2 != -50, "Oops! Try placing sam under where it says Bird Sprite at (-150, -50)")
t4 = TestObjective()
t4.add_success(tval4 == 150 and tval5 == -50, "Great job debugging the program.")
t4.add_failure(tval4 == -150 and tval2 == -50, "Oops! Try using smokey's name in the second glide to command.")
t4.add_failure(tval4 != 150 or tval2 != -50, "Oops! Try placing smokey under where is says Panther Sprite on the stage at (150, -50).")
tester = TestManager()
tester.add_test_list([t1, t2, t3, t4])
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)