Printing & Strings
Variables & PEMDAS
Booleans & If Statements
While & For Loops
Nested Loops & Logic Challenges
100

What symbol do we use to combine text in print statements?

+

100

What is a variable?

A container that holds data/value.

100

What two Boolean values exist in Python?

True and False

100

What is the main difference between a while loop and a for loop?

While = condition-based; For = count-based.

100

What is a nested loop?

A loop inside another loop.

200

Why must we use str() when printing numbers with text?

To convert a number into a string so it can be concatenated.

200

What is the output?
x = 3 + 4 * 2

11

200

Fill in the blank: if score >= 90: runs when the score is ___ or higher.

90

200

Write a loop that prints numbers 1–5.

python

for i in range(1, 6):

    print(str(i))

200

FREE POINTS

FREE POINTS

300

Predict the output:
word = "Hi" + "!" * 3
print(word)

Hi!!!

300

Predict the output:
a = 10
b = 5
c = a / b + (a - b) * 2

c = 10 / 5 + (10 - 5) * 2 = 2 + 10 = 12

300

What will this print?
x = 8
if x % 2 == 0 and x > 5:
print("Pass")
else:
print("Fail")

Pass

300

What’s the output?
x = 0
while x < 3:
 print("Loop")
 x = x + 2

“Loop” printed twice (x=0,2).

300

How many total prints will run?
for outer in range(1, 5):
 for inner in range(outer):
  print("#")

10 total (1+2+3+4).

400

What is printed?
greeting = "Hello "
name = "John"
print(greeting + name + "!")

Hello John!

400

What happens if you forget to convert a number to str() in a print statement?

You get a TypeError, because Python can’t add a string and an integer together.

400

Predict the output:
age = 16
has_id = False
if age >= 16:
 if has_id == True:
  print("Allowed")
 else:
  print("Need ID")

Need ID

400

What’s printed?
for i in range(2, 11, 3):
 print(str(i))

2, 5, 8

400

Predict the output:
for outer in range(1, 3):
 for inner in range(outer, 4):
  print("outer=" + str(outer) + " inner=" + str(inner))

outer=1 inner=1
outer=1 inner=2
outer=1 inner=3
outer=2 inner=2
outer=2 inner=3

500

Explain what happens:
greet = "Hi"
print(greet * 2 + " there")

Output: HiHi there — the string repeats first, then concatenates " there".

500

Find the value of result:
result = ((8 - 3) * 2 + 10 / 5) - (6 - 4)

(5 * 2 + 2) - 2 = (10 + 2) - 2 = 10

500

Create a program that asks for a user’s age and prints:
“Teen” if 13–19,
“Child” if under 13,
“Adult” otherwise.

age = int(input("Enter age: "))

if age < 13:

    print("Child")

elif age <= 19:

    print("Teen")

else:

    print("Adult")

500

Explain what happens: print? stop? iterations?
num = 10
while num > 2:
 num = num - 3
 print("Num = " + str(num))

Prints: 7, 4, 1 — stops when num ≤ 2. (3 total iterations.)

500

Challenge: Write a nested loop that prints this number triangle:
1
12
123
1234

for outer in range(1, 5):

    row = ""

    for inner in range(1, outer + 1):

        row = row + str(inner)

    print(row)