Skip to main content
Contents
Dark Mode Prev Up Next Scratch ActiveCode Profile
\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 16.5 Review - Variables
Practice identifying variables, assigning values, updating variables, and tracking how variables change during program execution.
Subsection 16.5.1 Part A: Recognize
For each line of code below, identify the variable name, the value being stored, and whether the variable is being created or updated.
age = 18
name = "Mia"
age = age + 1
city = "Charlotte"
Checkpoint 16.5.1 .
Complete a table with four columns: line of code, variable name, value stored, and create or update.
Subsection 16.5.2 Part B: Trace
Checkpoint 16.5.2 .
Trace the values of
score and
bonus after each line runs.
score = 10
bonus = 5
score = score + bonus
bonus = 2
score = score + bonus
Subsection 16.5.3 Part C: Fix
Checkpoint 16.5.3 .
The code below has an error. Update it so it runs correctly.
Checkpoint 16.5.4 .
The code below has an error. Update it so it runs correctly.
Checkpoint 16.5.5 .
The code below has an error. Update it so it runs correctly.
Subsection 16.5.4 Part D: Create
Checkpoint 16.5.6 .
Write code that creates a variable named
temperature and stores the value
72. Then update
temperature by adding
5. Create a variable named
greeting storing βHelloβ, and print both variables.
Subsection 16.5.5 Think About ...
Checkpoint 16.5.7 .
In your own words, what is the difference between creating a variable and updating a variable?
You have attempted
of
activities on this page.