CS in Algebra | Lesson 3

Strings and Images

Lesson time: 30-60 Minutes

Lesson Overview

To compute more than just numbers, students will need to learn about two new data types, Strings (any string of alphanumeric characters) and Images. Using these new data types, we'll compose programs that produce and manipulate images.

Lesson Objectives

Students will:

Anchor Standard

Common Core Math Standards

Additional standards alignment can be found at the end of this lesson

Teaching Summary

Getting Started

1) Vocabulary
2) Introduction

Activity: Strings and Images

3) Online Puzzles

Teaching Guide

Getting Started

1) Vocabulary

This lesson has four new and important words:

  • String - any sequence of characters between quotation marks (examples: "hello", "42", "this is a string!")
  • Image - a type of data for pictures
  • Type - refers to a general kind of data, like Number, String, Image, or Boolean

2) Introduction

In the previous stage, students only worked with a single type of value - Numbers. In this next stage they will get a chance to write programs with new data types to output text (Strings) and pictures (Images).

Show students the 'star' function, and ask them to discuss the following questions:

  • What is the name of this function?
  • How many arguments are being given to this function?
  • What do you think this function will do?

Students are not expected to know all the answers here - the goal is for them to apply what they know about Evaluation Blocks to a novel expression, and discuss for themselves what they think it might mean. Ask them to justify their answers, and to explain why they think they are correct. Encourage students to look for patterns among these new blocks (such as colors, or quotation marks around the words "solid" and "purple" - what might those patterns mean?

Activity: Strings and Images

3) Online Puzzles

In this activity you'll use the new data types String and Image to compose art with Blocks of Evaluation - head to CS in Algebra Stage 3 in Code Studio to get started programming.

Standards Alignment

Common Core Math Standards

  • 5.OA.1 - Use parentheses, brackets, or braces in numerical expressions, and evaluate expressions with these symbols.
  • 5.OA.2 - Write simple expressions that record calculations with numbers, and interpret numerical expressions without evaluating them. For example, express the calculation “add 8 and 7, then multiply by 2” as 2 × (8 + 7). Recognize that 3 × (18932 + 921) is three times as large as 18932 + 921, without having to calculate the indicated sum or product.
  • 6.NS.8 - Solve real-world and mathematical problems by graphing points in all four quadrants of the coordinate plane. Include use of coordinates and absolute value to find distances between points with the same first coordinate or the same second coordinate.
  • 6.EE.9 - Use variables to represent two quantities in a real-world problem that change in relationship to one another; write an equation to express one quantity, thought of as the dependent variable, in terms of the other quantity, thought of as the independent variable. Analyze the relationship between the dependent and independent variables using graphs and tables, and relate these to the equation. For example, in a problem involving motion at constant speed, list and graph ordered pairs of distances and times, and write the equation d = 65t to represent the relationship between distance and time.
  • 7.EE.4 - Use variables to represent quantities in a real-world or mathematical problem, and construct simple equations and inequalities to solve problems by reasoning about the quantities.
  • 8.F.1 - Understand that a function is a rule that assigns to each input exactly one output. The graph of a function is the set of ordered pairs consisting of an input and the corresponding output.1
  • 8.F.2 - Compare properties of two functions each represented in a different way (algebraically, graphically, numerically in tables, or by verbal descriptions). For example, given a linear function represented by a table of values and a linear function represented by an algebraic expression, determine which function has the greater rate of change.
  • A.SSE.1 - Interpret expressions that represent a quantity in terms of its context.
  • A.SSE.2 - Use the structure of an expression to identify ways to rewrite it. For example, see x4 – y4 as (x2)2 – (y2)2, thus recognizing it as a difference of squares that can be factored as (x2 – y2)(x2 + y2).
  • A.SSE.4 - Derive the formula for the sum of a finite geometric series (when the common ratio is not 1), and use the formula to solve problems. For example, calculate mortgage payments.★
  • A.REI.1 - Explain each step in solving a simple equation as following from the equality of numbers asserted at the previous step, starting from the assumption that the original equation has a solution. Construct a viable argument to justify a solution method.
  • F.IF.1 - Understand that a function from one set (called the domain) to another set (called the range) assigns to each element of the domain exactly one element of the range. If f is a function and x is an element of its domain, then f(x) denotes the output of f corresponding to the input x. The graph of f is the graph of the equation y = f(x).

Common Core Math Practices

  • MP.1 - Make sense of problems and persevere in solving them.
  • MP.2 - Reason abstractly and quantitatively.
  • MP.3 - Construct viable arguments and critique the reasoning of others.
  • MP.4 - Model with mathematics.
  • MP.5 - Use appropriate tools strategically.
  • MP.6 - Attend to precision.
  • MP.7 - Look for and make use of structure.
  • MP.8 - Look for and express regularity in repeated reasoning.

Derived from