Imports

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Imports

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does // do?
A Integer division (no decimal)
B Regular division
2. What does % do?
A Returns the remainder
B Calculates percentage
3. What does ** do?
A Multiplies twice
B Raises to a power (exponent)
4. What is 10 // 3?
A 3
B 3.33
5. What is 10 % 3?
A 3
B 1

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1result = 10 % 0 AError: Use ** not ^ for powers
22 ^ 3 BOk: 2 to the power 10
310 % 2 == 0 COutput: 2
42 ** 10 DValid: Check if even
5print(17 // 5) EError: Modulo by zero
6print(17 % 5) FOutput: 3

Definitions

//

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
print(10 __ 3) # Result: 3
2.
print(10 _ 3) # Result: 1
3.
print(2 __ 3) # Result: 8
4.
print(7 _ 2) # Result: 1 (remainder)
5.
print(5 __ 2) # Result: 25

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A a = 10
B b = 3
C result = a / / b
D print('Floor division:', result)
Question 2
A base = 2
B exp = 3
C result = base ^ exp
D print('Power:', result)
Question 3
A a = 10
B b = 3
C result = a % % b
D print('Remainder:', result)
Question 4
A base = 10
B exp = 3
C result = base * * exp
D print('Power:', result)
Question 5
A result = 10 mod 3
B a = 10
C b = 3
D print('Remainder:', result)

Answer Key

Imports
Section A: Quick Questions
Q1
A — Integer division (no decimal)
Q2
A — Returns the remainder
Q3
B — Raises to a power (exponent)
Q4
A — 3
Q5
B — 1
Section B: Match the Pairs
Q1
result = 10 % 0 → Error: Modulo by zero
Q2
2 ^ 3 → Error: Use ** not ^ for powers
Q3
10 % 2 == 0 → Valid: Check if even
Q4
2 ** 10 → Ok: 2 to the power 10
Q5
print(17 // 5) → Output: 3
Q6
print(17 % 5) → Output: 2
Section C: Definitions
Q1
// — Floor division - divides and rounds DOWN to the nearest integer.~~%
Section D: Fill in the Blanks
Q1
print(10 // 3) # Result: 3
Q2
print(10 % 3) # Result: 1
Q3
print(2 ** 3) # Result: 8
Q4
print(7 % 2) # Result: 1 (remainder)
Q5
print(5 ** 2) # Result: 25
Section E: Spot the Error
Q1
C — No space between the slashes: use // not / /
Q2
C — Python uses ** for power, not ^ (^ is a different operator)
Q3
C — Only one % sign for modulo: not %%
Q4
C — No space between the asterisks: use ** not * *
Q5
A — Python uses % for modulo, not the word 'mod'