Skip to main content
Contents Index
Dark Mode Prev Up Next Scratch ActiveCode Profile
\(\newcommand{\N}{\mathbb N} \newcommand{\Z}{\mathbb Z} \newcommand{\Q}{\mathbb Q} \newcommand{\R}{\mathbb R}
\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 8.15 Chapter Assessment
Checkpoint 8.15.1 .
Write a function called
int_return that takes an integer as input and returns the same integer.
Checkpoint 8.15.2 .
Write a function called
add that takes any number as its input and returns that sum with 2 added.
Checkpoint 8.15.3 .
Write a function called
change that takes any string, adds βNice to meet you!β to the end of the argument given, and returns that new string.
Checkpoint 8.15.4 .
You will need to write two functions for this problem. The first function,
divide that takes in any number and returns that same number divided by 2. The second function called
sum should take any number, divide it by 2, and add 6. It should return this new number. You should call the
divide function within the
sum function. Do not worry about decimals.
Checkpoint 8.15.5 .
The screenshot above depicts a CodeLens program mid-execution. We have a function called maximum() that is in the middle of its execution.
Checkpoint 8.15.6 .
Using the Codelens diagram screenshot, select all the variables that are local to the function generate_coords
Incorrect, NUM_COORDS is under the global frame in the Codelens screenshot. Look at the generate_coords frame
Correct, we are using the local version of MAX declared inside the function
Correct, we are using the local version of MIN declared inside the function
Incorrect, the x_coord append line is using a reference of the global frame list x_coord
Correct, the iterator variable is still a variable and in this case it is created locally inside the function
Checkpoint 8.15.7 .
Consider the above program. Which Codelens screenshot shows the correct program output?
You have attempted
of
activities on this page.