Lesson 21: Changing Variables with Artist
Overview
In this lesson, students will explore the creation of repetitive designs using variables in the Artist environment. Students will learn how variables can be used to make code easier to write and easier to read. After guided puzzles, students will end in a freeplay level to show what they have learned and create their own designs.
Purpose
Variables are essentially placeholders for values that might be unknown at the time that you run your program or for values that can change during the execution of a program. These are vital to creating dynamic code because they allow your program to change and grow based on any number of potential modifications. This stage reinforces the use of variables, using the most basic capabilities of setting and using them.
Agenda
Warm Up (5 min)
Main Activity (20 min)
Wrap Up (15 min)
View on Code Studio
Objectives
Students will be able to:
- Assign values to existing variables.
- Utilize variables in place of repetitive values inside of a program.
- Use variables to change values inside of a loop.
Preparation
- Play through the lesson to find any potential problem areas for your class.
- Make sure every student has a journal.
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the Students
- Variables - Student Video (download)
- Think Spot Journal - Reflection Journal
Vocabulary
- Variable - A label for a piece of information used in a program.
Support
Report a Bug
Teaching Guide
Warm Up (5 min)
Introduction
It might be helpful to remind students of "Variables that Change in Bee," since variables will be used in a similar way here.
- How can we change the value of a variable inside of a loop?
- Do we have to change the value of a variable only by one each time?
Main Activity (20 min)
Online Puzzles
The latter half of this series is made up of freeplay puzzles. Students will have the opportunity to play with variables, shape, and color to create something unique.
Wrap Up (15 min)
Journaling
Having students write about what they learned, why it’s useful, and how they feel about it can help solidify any knowledge they obtained today and build a review sheet for them to look to in the future.
Journal Prompts:
- What was today’s lesson about?
- How did you feel during today’s lesson?
- Have you tried mixing multiple variables into one program? What might that look like? When would it be helpful?
Student Instructions
Let's start this section by drawing a triangle with 150 pixel sides.
Be sure to use the length
variable and a repeat loop.
Student Instructions
Time to make some art!
See what happens when you repeat the code from the last puzzle 30 times instead of only 3!
Feel free to make your lines any color or pattern for some extra zest.
Student Instructions
Here's your code from the last puzzle. Try editing the variable in other ways.
- What happens if you start out with length
less than 150?
- What if you multiply your variable by 1.25 each time through?
- What will your code do if you turn 119 degrees?
Student Instructions
Freeplay: Take what you've learned and make your own drawing.
How can you use variables with squares, pentagons, or hexagons?
Student Instructions
You just learned "variables"!
In order to use a variable, it needs a name and a value. The name doesn't change, but the value can. This way you can use the name of the variable as a placeholder wherever you want in your program!
Vocab to Know
Variable - A placeholder for a piece of information that can change
Student Instructions
Challenge alert! Can you create a length
variable and use it to create this interesting pattern?
Student Instructions
You've now learned everything you need to know to make a pattern like this! This puzzle is meant to be difficult. Can you stick with it until you figure out the solution?
Standards Alignment
View full course alignment
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
- 1B-AP-09 - Create programs that use variables to store and modify data.
- 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.
Cross-curricular Opportunities
This list represents opportunities in this lesson to support standards in other content areas.
Common Core English Language Arts Standards
L - Language
- 5.L.6 - Acquire and use accurately grade-appropriate general academic and domain-specific words and phrases, including those that signal contrast, addition, and other logical relationships (e.g., however, although, nevertheless, similarly, moreover, in addition).
SL - Speaking & Listening
- 5.SL.1 - Engage effectively in a range of collaborative discussions (one-on-one, in groups, and teacher-led) with diverse partners on grade 5 topics and texts, building on others’ ideas and expressing their own clearly.
- 5.SL.1.a - Come to discussions prepared, having read or studied required material; explicitly draw on that preparation and other information known about the topic to explore ideas under discussion.
- 5.SL.4 - Report on a topic or text or present an opinion, sequencing ideas logically and using appropriate facts and relevant, descriptive details to support main ideas or themes; speak clearly at an understandable pace.
- 5.SL.6 - Adapt speech to a variety of contexts and tasks, using formal English when appropriate to task and situation.
Common Core Math Standards
G - Geometry
- 5.G.2 - Represent real world and mathematical problems by graphing points in the first quadrant of the coordinate plane, and interpret coordinate values of points in the context of the situation.
- 5.G.3 - Understand that attributes belonging to a category of two- dimensional figures also belong to all subcategories of that category. For example, all rectangles have four right angles and squares are rectangles, so all squares have four right angles.
MP - Math Practices
- MP.1 - Make sense of problems and persevere in solving them
- MP.2 - Reason abstractly and quantitatively
- MP.6 - Attend to precision
- MP.7 - Look for and make use of structure
- MP.8 - Look for and express regularity in repeated reasoning
NBT - Number And Operations In Base Ten
- 5.NBT.5 - Fluently multiply multi-digit whole numbers using the standard algorithm.
Next Generation Science Standards
ETS - Engineering in the Sciences
ETS1 - Engineering Design
- 3-5-ETS1-1 - Define a simple design problem reflecting a need or a want that includes specified criteria for success and constraints on materials, time, or cost.