stage.set_background("underwater")
score = 0
score_board = codesters.Display(score)
weak_pws = ["password", "password123", "hello1", "snuffles", "123456"]
strong_pws = ["GgbvTa581!@", "@Mjrc0olguy!", "007jmSB0nd!", "108turt!es762", "Avv3SoMe!305"]
all_pws = weak_pws + strong_pws
# text = codesters.Text("text", x, y, "color")
password = codesters.Text("password", 100, 200, "red")
t = codesters.Teacher()
try:
tval1 = t.find_block('def')[0][1]
except:
tval1 = "DNE"
try:
tval2 = t.find_function('turn_left')[0][0]
except:
tval2 = "DNE"
try:
tval3 = t.find_function('randint')[0][0]
tval3a = t.get_indent_at_line(tval3)
except:
tval3 = "DNE"
tval3a = "DNE"
try:
tval4 = t.find_function('event_interval')[0][0]
tval4a = t.get_indent_at_line(tval4)
except:
tval4 = "DNE"
tval4a = "DNE"
t1 = TestObjective()
t1.add_success('interval' in tval1, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add an Interval Event to your program?")
t1.add_failure('interval' not in tval1, "Make sure you add an Interval Event to your program!")
t2 = TestObjective()
#t2.add_success(tval2 == "DNE", "Great job!")
t2.add_failure(tval2 != "DNE", "Make sure you delete the Turn Left command from inside your Interval Event!")
t3 = TestObjective()
t3.add_success(tval3a == 4, "Great job!")
t3.add_failure(tval3a == "DNE", "Did you add a Random Integer command to your event?")
t3.add_failure(tval3a < 4, "Make sure your Random Integer command is indented 4 spaces inside your Interval Event!")
t3.add_failure(tval3a > 4, "Make sure your Random Integer command is indented only 4 spaces inside your Interval Event.")
t4 = TestObjective()
t4.add_success(tval4a == 0, "Great job!")
t4.add_failure(tval4a == "DNE", "Oops! Did you dleete your event handler? Make sure you keep the last line of your event!")
t4.add_failure(tval4a > 0, "Make sure the last line of your event is not indented at all!")
tester = TestManager()
tester.add_test_list([t1, t2, t3, t4])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
提交作品
-
下个活动
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)