INSTRUCTIONS:

  • Follow the instructions on the stage to complete this interactive learning activity.
  • Look out for key terms marked with a ★!
  • Sometimes you will have to complete a task on the stage to continue. Pay attention!
  • At the end of the activity click Submit and Next to move on!

To navigate the page using the TAB key, first press ESC to exit the code editor.

import codesters import random from codesters.demo import Demo from codesters import Text # Set constants stage_height = float(stage.get_stage_height()) stage_width = float(stage.get_stage_width()) offstage_below = -1000 # Use as y value to create objects below the stage wait_time = 1 # Create Demo instance demo = Demo() # Set up stage stage.auto_cache_off() # Create Matrix Background stage.set_background("custom_back_c22") chars = [] opacity = 1 x = -540 y = stage_height/2 for counter in range(15): opacity = 1 if counter % 2 == 0: y = stage_height/2 else: y = stage_height/2 + 7.5 for counter in range(random.randint(15, 25)): letter_num = random.randint(33, 255) letter = codesters.Text(chr(letter_num), x, y, "lightgreen") letter.set_text_size(20) letter.set_opacity(opacity) chars.append(letter) opacity -= .05 y -= 20 x += random.choice([50, 100]) def interval(): char_change = random.choice(chars) char_change.set_text(chr(random.randint(33, 255))) stage.event_interval(interval, 1) back_tint = codesters.Rectangle(0, 175, 500, 100, "black") back_tint.set_opacity(0.7) lesson_title = Text("Cybersecurity: Introduction", 0, 200, "white") lesson_title.set_text_width(800) lesson_title.set_text_size(40) activity_title = Text("Coding in Cybersecurity", 0, 150, "white") activity_title.set_text_width(600) activity_title.set_text_size(30) stage.wait(wait_time*1) guide = demo.create_sprite_off_screen("person20", -stage_width/2-50, -150, 1) guide.move_forward(stage_width/2+50) demo.continue_action() stage.remove_sprite(back_tint) lesson_title.set_speed(10) lesson_title.glide_to(0, 1000) activity_title.set_speed(10) activity_title.glide_to(0, 1000) demo.remove_all_sprites_except([guide]+chars) stage.wait(wait_time) guide_text = codesters.Text("In this course, you will learn about cybersecurity!\n\n\n", 0, 150) guide_text.set_text_background("silver", "white", 1) guide_text.set_text_height(25) guide_text.set_text_size(22) guide_text.set_text_width(800) stage.wait(wait_time*2) guide_text.set_text("In this course, you will learn about cybersecurity!\nYou will also learn how to code in Python.\n\n") stage.wait(wait_time*2) guide_text.set_text("In this course, you will learn about cybersecurity!\nYou will also learn how to code in Python.\nAt the end of the course, you will be able to create a secure password generator,\n") stage.wait(wait_time*2) guide_text.set_text("In this course, you will learn about cybersecurity!\nYou will also learn how to code in Python.\nAt the end of the course, you will be able to create a secure password generator,\nas well as encrypt and decrypt text!") stage.wait(wait_time*3) demo.continue_action() guide_text.set_text("Click Submit and Next to begin your first coding exercise!") sprite_list = demo.remind_student_to_submit(guide.get_x() - 175, guide.get_y() + 200, 25) for sprite in sprite_list: if sprite.get_name() == 'line' or sprite.get_name() == 'arrowLine': sprite.set_color("white") elif sprite.get_text() != None: sprite.set_color("white") tester = TestManager() tester.display_success_message("Great job!") stage.wait(10) stage.event_interval(interval, None)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)