Skip to main content\(
\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.1 Code Tracing
Checkpoint 16.1.1.
Write the output of this code snippet.
count = 1
while count <= 5:
print(count)
count += 1
Checkpoint 16.1.2.
Write the output of this code snippet.
for i in range(2, 10, 2):
print(i)
Checkpoint 16.1.3.
Write the output of this code snippet.
x = 0
for i in range(3):
x += i
print(x)
Checkpoint 16.1.4.
Write the output of this code snippet.
num = 5
while num > 0:
if num % 2 == 0:
print("even")
else:
print("odd")
num -= 1
Checkpoint 16.1.5.
Write the output of this code snippet.
text = "hello world"
words = text.split()
print(words)
Checkpoint 16.1.6.
Write the output of this code snippet.
text = "python"
print(text.upper())
Checkpoint 16.1.7.
Write the output of this code snippet.
numbers = [1, 2, 3]
numbers.append(4)
print(numbers)
Checkpoint 16.1.8.
Write the output of this code snippet.
text = "a,b,c"
parts = text.split(",")
print(parts[1])
You have attempted
of
activities on this page.