INSTRUCTIONS:

  • Follow the instructions on the stage to complete this assessment activity.
  • If you finish the assessment and don’t see the "Great Job" feedback, click Run to try again.
  • When you see "Great Job", click Submit and Next to move on.

import codesters import random from codesters.demo import Demo from codesters import Text demo = Demo() stage.set_background_color("white") guide = codesters.Sprite("person1", 0, -200) guide.say("Let's play a game to review!") stage.wait(1) demo.continue_action() def play_game(): global user_answered_yes demo.remove_all_sprites_except(guide) guide.say("Now, classify each image as a system or not a system!") stage.wait(2) guide.move_down(75) # Set up the images we'll be using and the explanations once a student clicks on an image computers_list = ["animal_cell", "grand_piano", "motorcycle", "mangrove_tree", "muscular_system"] noncomputers_list = ["toolbox", "book_stack", "pile_of_screws", "toy_blocks", "car_wreck"] explanation_dict = { "animal_cell": ("An animal cell is a system because it has many parts (organelles) that work together to keep it alive.", "animal cell"), "grand_piano": ("A piano is a system because it has parts (keys, hammers, pedals), that work together to make music.", "piano"), "motorcycle": ("A motorcycle is a system because it has many parts (tires, seat, handles...) that work togther to move someone.", "motorcycle"), "mangrove_tree": ("A tree is a system because it has parts (roots, branches) that work together to keep the tree alive.", "tree"), "muscular_system": ("A person's muscles are a system because they work together to help a person move.", "muscles"), "toolbox": ("A toolbox isn't a system because although it has many parts, they don't work together.", "toolbox with tools"), "book_stack": ("A stack of books isn't a system because, while it has many books, they don't work together.", "books"), "toy_blocks": ("A heap of blocks isn't a system. Even though there are many parts, they don't work together.", "blocks"), "pile_of_screws": ("A pile of screws isn't a system because while it has many parts, they don't work together.", "screws"), "car_wreck": ("A wrecked car isn't a system because its parts don't work together...anymore.", "wrecked car") } # Create a combined list and shuffle it, so we'll be able to randomize where the images appear full_list = noncomputers_list + computers_list random.shuffle(full_list) def yes_click(sprite): global user_answered_yes user_answered_yes = True demo.unpause() def no_click(sprite): global user_answered_yes user_answered_yes = False demo.unpause() def add_to_score_animation(is_correct, score_text): if is_correct: animation = codesters.Text("+1", score_text.get_x() + score_text.get_width()/2 + 15, score_text.get_y(), "green") create_feedback(u"✓", "green") else: animation = codesters.Text("-1", score_text.get_x() + score_text.get_width()/2 + 15, score_text.get_y(), "red") create_feedback(u"✕", "red") animation.set_size(0.75) animation.turn_right(360) stage.wait(0.2) stage.remove_sprite(animation) def create_feedback(input, color): text = codesters.Text(input, 0, 0, color) opacity = 1 size = 20 for counter in range(20): opacity -= .05 size += 20 text.set_opacity(opacity) text.set_text_size(size) stage.wait(0.0001) stage.remove_sprite(text) # Important variables user_answered_yes = None counter = 1 correct = 0 incorrect = 0 # Set up the score and their displays correct_text = codesters.Text("Correct: 0", -150, 250, "green") incorrect_text = codesters.Text("Incorrect: 0", 150, 250, "red") question_number = codesters.Text("", 0, 250) yes_button = demo.create_button("Yes " + u"✓", -200, -280, True, "white", "green", 250, 50, "") no_button = demo.create_button("No " + u"✕", 200, -280, True, "white", "red", 250, 50, "") # Cycle through every image label in our full list for image_label in full_list: question_number.set_text(str(counter) + " / " + str(len(full_list))) # Create the sprite off screen and have it move on screen sprite = codesters.Sprite(image_label, -600, 50) # setting size - Chaya # sprite.set_size(1.75) sprite.set_speed(15) sprite.move_right(600) sprite_label = codesters.Text(explanation_dict[image_label][1], 300, 50) arrow = codesters.Arrow(sprite_label.get_x() - sprite_label.get_width()/2 - 10, 50, sprite.get_x() + sprite.get_width()/2 + 10, 50) # Ask the user if the sprite is a computer and load actions # onto the buttons guide.say("Is this a system?") yes_button.event_click(yes_click) no_button.event_click(no_click) demo.pause() # Remove actions from the buttons yes_button.opacity_off() no_button.opacity_off() yes_button.set_opacity(.5) no_button.set_opacity(.5) yes_button.event_click(demo.return_delete_event_one()) no_button.event_click(demo.return_delete_event_one()) # Find out if the image is a computer is_a_computer = image_label in computers_list # If the image is a computer and the user answered correctly, let them know if is_a_computer and user_answered_yes: guide.say("Nice! " + explanation_dict[image_label][0]) correct += 1 correct_text.set_text("Correct: " + str(correct)) add_to_score_animation(True, correct_text) # If the image is not a computer and the user answered correctly, let them know elif not is_a_computer and not user_answered_yes: guide.say("Nice! " + explanation_dict[image_label][0]) correct += 1 correct_text.set_text("Correct: " + str(correct)) add_to_score_animation(True, correct_text) # Otherwise, tell them that they were wrong else: guide.say("Oops! " + explanation_dict[image_label][0]) incorrect += 1 incorrect_text.set_text("Incorrect: " + str(incorrect)) add_to_score_animation(False, incorrect_text) # Show the next button and pause stage.wait(2) demo.continue_action() # Hide the next button and move the sprite off stage guide.say("") demo.remove_sprites([sprite_label, arrow]) sprite.move_right(600) stage.remove_sprite(sprite) counter += 1 yes_button.opacity_on() yes_button.set_opacity(1) no_button.opacity_on() no_button.set_opacity(1) question_number.hide() yes_button.hide() no_button.hide() correct_text.move_down(100) incorrect_text.move_down(100) guide.move_up(100) if correct == 1: guide.say("You got " + str(correct) + " question correct out of " + str(len(full_list)) + " questions in total.") else: guide.say("You got " + str(correct) + " questions correct out of " + str(len(full_list)) + " questions in total.") # Test to see if the student gets every question correct. If not, they don't pass the lesson. tester = TestManager() if correct == len(full_list): tester.display_success_message("Great job!") sprite_list = demo.remind_student_to_submit(guide.get_x() - 180, guide.get_y() + 175, 25) for counter in range(5): for sprite in sprite_list: sprite.set_opacity(.7) stage.wait(0.2) for sprite in sprite_list: sprite.set_opacity(1) stage.wait(0.2) else: tester.display_failure_message("Darn! Play again to get all questions correct!") demo.play_again() guide.go_to(guide.get_x(), guide.get_y() - 25) play_game() play_game()