# sprite = codesters.Circle(x, y, diameter, "color")
sun = codesters.Circle(-150, 175, 75, "gold")
# sprite = codesters.Square(x, y, width, "color")
house = codesters.Square(0, -125, 250, "purple")
# sprite = codesters.Triangle(x, y, size, "color")
roof = codesters.Triangle(0, 0, 300, "blue")
try:
tval1 = roof.get_x()
except:
tval1 = "DNE"
try:
tval2 = roof.get_y()
except:
tval2 = "DNE"
try:
tval3 = str(roof.get_color())
except:
tval3 = "DNE"
t1 = TestObjective()
t1.add_failure(tval1 == "DNE", "Did you rename your triangle?")
t1.add_failure(tval1 == 100 and tval2 != 0, "Did you change your x-coordinate instead?")
t1.add_failure(tval1 >250 or tval1 < -250, "Did you move your roof off the stage?")
t2 = TestObjective()
t2.add_success(tval2 == 100, "Great Job!")
t2.add_failure(tval2 == "DNE", "Did you rename your triangle?")
t2.add_failure(tval2 == 0, "Did you change the y-coordinate?")
t2.add_failure(tval2 > 250 or tval2 < -250, "Did you move your roff off the stage?")
t2.add_creative(tval2 != 100 and tval2 != 0, "That's a creative location for your roof!")
t3 = TestObjective()
t3.add_success(tval3 == "green", "Great Job!")
t3.add_failure(tval3 == "DNE", "Did you delete your roof?")
t3.add_failure(tval3 == "blue", "Did you change the triangle's color?")
t3.add_creative(tval3 != "green" and tval3 != "blue", "Nice color choice!")
tester = TestManager()
tester.add_test_list([t1, t2, t3])
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)