< Course F (2021)

Lesson 7: Text and Prompts

45 minutes

Overview

In this skill-building lesson, students will get practice with variables in Sprite Lab.

Purpose

Variables will be used in this course to store and modify data. At this point, students will simply be storing and retrieving values without changing them. In later lessons, students will store numerical values and modify them over time to keep track of things like a player’s score in a game.

CSTA K-12 Computer Science Standards (2017)
    • 1B-AP-08 - Compare and refine multiple algorithms for the same task and determine which is the most appropriate.
    • 1B-AP-09 - Create programs that use variables to store and modify data.
    • 1B-AP-10 - Create programs that include sequences, events, loops, and conditionals.
    • 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.

Agenda

Objectives

Students will be able to:
  • Use variables in conjunction with prompts.
  • Use variables to hold words and phrases.

Preparation

Play through the levels and review the lesson slides.

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the teachers

Vocabulary

  • Prompt - A message on the computer screen that waits for input from the user.
  • Variable - A label for a piece of information used in a program.

Teaching Guide

Warm Up (5 minutes)

Review

Do This: Remind students what they did last class or ask them to share.

Discuss: How do computer programs ask us for information?

Discussion Goal: Students should think about their own experiences as users and times when a computer asks them for information. There are lots of ways to input information into a computer, but focus on ideas where something is typed into a prompt for now.

Remarks

At the end of the last lesson, we were looking at the similarities between blank space stories and apps that ask a user for input. When a message on the computer screen is waiting for your input we call that a prompt. When a user types into a prompt, it’s like the computer is storing the information in a container. The variable's label tells us what kind of information to expect. Today we are going to learn the code to create a prompt in Sprite Lab.

Main Activity (30 minutes)

Text and Prompts

Prediction (5 mins)

Do This: Have students read the provided code and make a prediction about what will happen. After pressing “Run”, provide time for students to reflect on anything they found interesting or that surprised them.

Video (5 minutes)

Display the video to the whole class.

Teaching Tip

Just like when students are writing or communicating verbally, it's important to set expectations on using words appropriately in this activity. Students should understand that they are responsible for the code that they write, including any text that shows on the screen. The text should be respectful, as well as safe. Students can practice not sharing personal information in their programs, especially if they want to share with others. Note that any information typed into a Sprite Lab prompt isn't saved long-term. Words and messages typed by the users of these apps is gone once the app is reset.

Skill Building and Practice (20 mins)

Transition: Have students move to their computer and sign in. These activities are suitable for independent learning or pair programming.

Students should complete the Skill Building levels and then spend any remaining time choosing from the various Practice activities.

Teaching Tip

This lesson has more skill building and practice levels than previous lessons, because students are learning a few new skills all at once. As such, there is not a dedicated “free play” level. However, students who are feeling confident with their new skills can choose the last practice option to start from scratch with a blank project. In the next lesson, students will also be working exclusively on their own project that they plan and design ahead of time.

Wrap Up (10 minutes)

Review

Do This: Use the lesson slides to review the vocabulary for this lesson. Be sure that students can recall from the lesson where they saw each of these concepts.

Remarks

When a user enters information into a prompt, the computer stores it with a variable. The prompt can also trigger an event. If the code uses a variable, the computer will look for a matching label to find the stored information.

Reflection

Pick one (or both) of the reflection prompts below to give to students. They can journal individually, or discuss the answers in groups or as a class.

Prompts:

  • How is a variable like a box? How is it different?

  • Why do programmers need variables?

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.