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
t = codesters.Teacher()
try:
params = t.get_parameters_for_function('Text')
tval1 = params[0][0]
tval1a = password.get_text()
except:
tval1 = "DNE"
tval1a = "DNE"
try:
params = t.get_parameters_for_function('Text')
tval2 = params[0][1]
tval3 = params[0][2]
tval4 = params[0][3]
except:
tval2 = "DNE"
tval3 = "DNE"
tval4 = "DNE"
t1 = TestObjective()
t1.add_success("password" in tval1 and tval1a != "DNE", "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add a Text object from Shapes ?")
t1.add_failure(tval1a == "DNE", "Did you add a Text object and name it password?")
t1.add_failure(tval2 == "DNE" or tval3 == "DNE" or tval4 == "DNE", "Did you add a Text in Color command?")
t1.add_failure("Hello in red" in tval1, "Did you replace the default text in the text in color command?")
t1.add_failure("password" not in tval1 and tval1 != "DNE", 'Make sure you change the text in your Text command to "password".')
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Enviar Trabajo
-
Actividad Siguiente
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)