← Python

Tuples – Operations

Tuples support indexing, slicing, and unpacking but cannot be modified after creation

What it does: Enum is imported from Python's built-in enum module. .value returns the integer (or string) assigned to the member. An enum gives meaningful names to a fixed set of values — like Color.RED instead of 1. Color.REED would be an error; 'reed' would silently pass through. .name returns the identifier string — useful for display or logging. Enum members support == comparison — identity checks (is) also work. Iterating an Enum class yields each member in definition order. Enum members are instances of the enum class, not plain integers.

Common mistakes: Must import Enum first: from enum import Enum. Duplicate values create aliases, not new members. Use unique values.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What is an enumeration?
A set of named constantsA type of list
Matches
❌ from Enum import enum
Error: Incorrect import — use from enum import Enum
Applying
Meanings
Term
Enum
Meaning
A class for creating sets of named constants.
Practice
from enum import Enum
Testing
Gaps
from enum import
Check Answer
Spots
1class Color(Enum):
2 RED = 1

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Nautilus' badge — Default Expert, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What is an enumeration?
A. A set of named constants ✓
B. A type of list
An enum gives meaningful names to a fixed set of values — like Color.RED instead of 1
2. Why use enums instead of strings?
A. They're faster
B. Prevents typos and invalid values ✓
Color.REED would be an error; 'reed' would silently pass through
3. Color.RED.value returns?
A. The value assigned to RED (e.g., 1) ✓
B. The string 'RED'
.value gives the underlying number or string — .name gives the member's identifier
4. Color.RED.name returns?
A. 1
B. 'RED' (the name as a string) ✓
.name returns the identifier string — useful for display or logging
5. Can enum members be compared?
A. Yes Color.RED == Color.RED is True ✓
B. No
Enum members support == comparison — identity checks (is) also work

Match the Pairs

from Enum import enum Error: Incorrect import — use from enum import Enum
Color(RED) Error: Access members with Color.RED
from enum import Enum Valid: Correct import for Enum class
Color.RED.value Ok: Access the numeric value of an enum member
list(range(3)) Output: [0, 1, 2]
type(True) Output: <class 'bool'>

Key Term

Enum
A class for creating sets of named constants.~~Member

Fill in the Blanks

1. from enum import Enum class Color(Enum): RED = 1
2. class Color(Enum): RED = 1
3. print(Color.RED.value)
4. print(Color.RED.name)
5. for c in Color: print(c)

Spot the Error

Question 1
A class Color(Enum):
B RED = 1
Line A — Must import Enum first: from enum import Enum
Question 2
A from enum import Enum
B
C class Color(Enum):
D RED = 1
E GREEN = 1
Line E — Duplicate values create aliases, not new members. Use unique values.
Question 3
A from enum import Enum
B
C class Color(Enum):
D RED = 1
E
F Color.RED = 2
Line F — Cannot reassign enum members they are immutable
Question 4
A from enum import Enum
B
C class Color(Enum):
D red = 1
Line D — Convention: enum member names should be UPPER_CASE
Question 5
A from enum import Enum
B
C class Color(Enum):
D RED = 1
E
F if color == 'RED':
Line F — Compare with Color.RED, not the string 'RED'
For Teachers

Create a free class, add this module to a journey, and track who's stuck.

Create a free teacher account →

No credit card. No setup fee. Make a class and invite students in under three minutes.

For Students

Practice this topic interactively, track progress, and unlock badges.

Start Learning Free →

Have a class code?