# Lesson 1: Evaluation Blocks and Arithmetic Expressions

## Overview

Students will begin using Evaluation Blocks to explore the concept of math as a language, and more specifically, a programming language. By composing arithmetic expressions with Evaluation Blocks, students will be able to visualize how expressions follow the order of operations.

## Purpose

In this lesson students get their first taste of the programming language and environment that they'll use throughout this course. While the environment and block-based language we're using here look a lot like things students may have seen in Scratch or the Hour of Code, it's important to understand that the kind of programming we're doing here is a bit different. In order to better align with the rules of Algebra we are following a programming paradigm known as Functional Programming. This difference may not matter to your students, but for those who have some existing programming experience you may ask them to research this different paradigm and report back on the similarities and differences.

## Agenda

### Getting Started

### Activity: Evaluation Blocks

## Anchor Standard

### Common Core Math Standards

**A.SSE.1**- Interpret expressions that represent a quantity in terms of its context.

## Objectives

### Students will be able to:

- Convert arithmetic expressions to and from code.
- Use Evaluation Blocks to reflect the proper order of operations for an expression.

## Links

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

### For the Students

- Evaluation Blocks Worksheet - Worksheet
- CS in Algebra Lesson 2 Slide Deck - Slide Deck

## Vocabulary

**Evaluate**- Perform the computation in an expression, producing an answer.**Evaluation Block**- A block of code that represents the structure of an expression**Expression**- Any valid unit of code that resolves to a value.**Function**- A mathematical object that takes in some inputs and produces an output.**Value**- A specific piece of data, like 5 or "hello".

## Support

### Report a Bug

# Teaching Guide

## Getting Started

Welcome to Code.org CS in Algebra! In this course you’ll be learning a new programming language - a way to tell computers exactly what you want them to do. Just like English, Spanish or French, a programming language has its own vocabulary and grammar that you’ll have to learn. Fortunately, the language you’ll be using here has a lot in common with the simple math that you already know!

### Learning a Language

Discuss as a class the nature of language, for example: - What makes a language? - Does anyone speak a second (or third) language? Do you speak a different language than your parents/grandparents? - Are there languages that share features, such as a common root (Romance, Germanic) or a similar alphabet (Latin, Cyrillic, Arabic, Kanji)? - Are there languages that are designed for specific purposes or within certain constraints (sign language, Esperanto)? - Math is a language, just like English, Spanish, or any other language! - We use nouns, like "bread", "tomato", "mustard" and "cheese" to describe physical objects. Math has values, like the numbers 1, 2 or 3, to describe quantities. - We also use verbs like "toast", "slice", "spread" and "melt" to describe operations on these nouns. Mathematics has functions like addition and subtraction, which are operations performed on numbers. - Just as you can "slice piece of bread", a person can also "add four and five".

A mathematical expression is like a sentence: it’s an instruction for doing something. The expression 4+5 tells us to add 4 and 5. To evaluate an expression, we follow the instructions in the expression. The expression 4+5 evaluates to 9.

Sometimes, we need multiple expressions to accomplish a task. If you were to write instructions for making a sandwich, it could matter very much which came first: melting the cheese, slicing the bread, spreading the mustard, etc. The order of functions matters in mathematics, too. If someone says "four minus two plus one," they could mean several things:

- Subtract two from four, then add one:
**(4 - 2) + 1** - Add two and one, and subtract the result from four:
**4 - (2 + 1)**

Depending on which way you read the expression, you might have very different results! This is a problem, because we often use math to share calculations between people. For example, you and your cell phone company should agree upfront on how much you will pay for sending text messages and making calls. Different results might mean that your bill looks wrong. We avoid problems by agreeing on the order in which to use the different operations in an expression. There are two ways to do this:

- We can all agree on an order to use
- We can add detail to expressions that indicate the order

Mathematicians didn’t always agree on the order of operations, but now we have a common set of rules for how to evaluate expressions. When evaluating an expression, we begin by applying the operations written at the top of the pyramid (multiplication and division). Only after we have completed all of those operations can we move down to the lower level. If both operations are present (as in 4 - 2 + 1), we read the expression from left to right, applying the operations in the order in which they appear.

Evaluation Blocks provide a visual way to indicate the order of operations in an expression.

All Evaluation Blocks follow three rules:

**Rule 1**: Each block must have one function, which is displayed at the top of the block.**Rule 2**: The values for that function are placed below, in order from left to right.**Rule 3**: If a block contains another block as a value, that inner block must be evaluated before the outer block.

Before students get started on the computers, you can have them work through the Evaluation Blocks Worksheet in the student workbook.

## Activity: Evaluation Blocks

### Online Puzzles

The programming language you are going to learn uses Evaluation Blocks to visually represent mathematical functions. Each block of code is either a Function, or a Value - head to CS in Algebra, Course A Stage 1 in Code Studio to get started programming.

### Student Instructions

You’ll be writing a kind of code called Evaluation Blocks, because each block of code evaluates to a single value. Change the ??? in this code so that the block evaluates to 5.

### Student Instructions

This Evaluation Block is a multiplication function which takes two numbers and returns the product of those numbers. Edit this block so that it multiplies 2 * 5

### Student Instructions

Here's a function for addition which takes two numbers and returns their sum. Use this Addition Block to add 3 + 6.

### Student Instructions

Here we've nested an Addition Block inside a Multiplication Block. Complete this code so it multiplies 3 by (4 + 1)

### Student Instructions

Use a Multiplication Block to complete this code.

### Student Instructions

Complete the Evaluation Blocks to match this statement.

### Student Instructions

This code is missing a couple of Evaluation Blocks - make sure you put everything in the right order.

### Student Instructions

Complete the Evaluation Blocks to match this statement.

### Student Instructions

Complete the Evaluation Blocks to match this statement.

### Student Instructions

Complete the Evaluation Blocks to match this statement.

### Student Instructions

### Student Instructions

### Student Instructions

### Student Instructions

### Student Instructions

Free Play: Try using the Evaluation Blocks to write some equations of your own. How does nesting the blocks in different ways impact their evaluation?

## Standards Alignment

#### View full course alignment

#### Common Core Math Standards

**EE** - Expressions And Equations

**6.EE.2**- Write, read, and evaluate expressions in which letters stand for numbers.

**MP** - 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

**NS** - The Number System

**6.NS.5**- Understand that positive and negative numbers are used together to describe quantities having opposite directions or values (e.g., temperature above/below zero, elevation above/below sea level, credits/debits, positive/negative electric charge); use posit**6.NS.6**- Understand a rational number as a point on the number line. Extend number line diagrams and coordinate axes familiar from previous grades to represent points on the line and in the plane with negative number coordinates.**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.

**OA** - Operations And Algebraic Thinking

**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 t

**Q** - Quantities

**N.Q.1**- Use units as a way to understand problems and to guide the solution of multi-step problems; choose and interpret units consistently in formulas; choose and interpret the scale and the origin in graphs and data displays.**N.Q.2**- Define appropriate quantities for the purpose of descriptive modeling.

**REI** - Reasoning With Equations And Inequalities

**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.

**SSE** - Seeing Structure In Expressions

**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.★