← VCE Software Development U3O1

Snake casing

A naming convention that writes every letter in lower case and joins words with underscores, e.g. student_first_name. Python uses it for variables and functions.

Understanding Snake casing in VCE Software Development U3O1

What it does: The function name calculate_total_price is all lower case with underscores, which follows the snake case convention for Python functions. To convert from camel case, put an underscore before each capital letter and change that letter to lower case. Variable names cannot contain spaces. Snake casing replaces each space with an underscore. Each word must be separated by an underscore. Without underscores the words run together and are hard to read. A hyphen is read as a minus sign in Python, so user-age would subtract. Use an underscore instead. UPPER_SNAKE_CASE is the snake case style used for constants, so readers know the value should not change.

Common mistakes: lastName is camelCase. Python variables use snake_case, so it should be last_name. The print line also expects last_name. The function is defined as get_total, but this call uses camelCase. Function names in snake_case must be called with the same name: get_total(2, 3).

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 48–71) and word search (Modules 10–71).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which variable name uses snake casing?
student_first_namestudentFirstName
Matches
Student_First_Name = "Liam"
↓
Snake case variable names must be all lower case. Capital letters should not be used, so it should be student_first_name.
Applying
Meanings
Term
snake_case
Meaning
A naming convention that writes every letter in lower case and joins words with underscores, e.g. student_first_name. Python uses it for variables and functions.
Practice
MAX_ATTEMPTS = 3
Testing
Gaps
totalmarks = 85
Check Answer
Spots
1first_name = 'Ava'
2lastName = 'Nguyen'

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

The 'Narwhal' badge — Unicorn Coder, 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. Which variable name uses snake casing?
A. student_first_name ✓
B. studentFirstName
Snake casing is all lower case with underscores between words. studentFirstName is camel casing.
2. Which function definition follows Python's snake case convention?
A. def calculate_total_price(): ✓
B. def CalculateTotalPrice():
Python functions use snake_case. CalculateTotalPrice joins words with capital letters and has no underscores.
3. What is the snake case version of the camel case name highScore?
A. high_Score
B. high_score ✓
When converting, put an underscore where each capital letter was and make every letter lower case. high_Score still has a capital.
4. Which name is correct snake casing for a variable?
A. total_marks ✓
B. total marks
Variable names cannot contain spaces. Snake casing replaces each space with an underscore.
5. Which constant name follows the UPPER_SNAKE_CASE convention?
A. max_attempts = 3
B. MAX_ATTEMPTS = 3 ✓
Constants are written in capital letters with underscores between words. Lower case snake_case is used for ordinary variables.

Match the Pairs

student_first_name = "Ava" → A Python variable named in snake case: all lower case with underscores between words
MAX_ATTEMPTS = 3 → A constant named in UPPER_SNAKE_CASE: all capitals with underscores between words
Python functions are named in snake case, with lower case words joined by underscores → def calculate_total_price(items):
Converting the camel case name studentFirstName to snake case → student_first_name
Student_First_Name = "Liam" → Snake case variable names must be all lower case. Capital letters should not be used, so it should be student_first_name.
def get-average-mark(marks): → Hyphens cannot be used in Python names. Words must be joined with underscores, so it should be get_average_mark.

Key Term

snake_case
A naming convention that writes every letter in lower case and joins words with underscores, e.g. student_first_name. Python uses it for variables and functions.

Fill in the Blanks

1. total_marks = 85
Hint: Type the character that joins the words in a snake case name.
2. first_name = "Ava" print(first_name)
Hint: Type the variable name being assigned, written in snake case to match the name printed on the next line.
3. def get_total(a, b): return a + b print(get_total(2, 3))
Hint: Type the snake case function name that matches the call on the last line.
4. MAX_SCORE = 100 score = 120 print(score > MAX_SCORE)
Hint: Type the constant name in upper snake case that is used in the comparison on the last line.
5. # camelCase: studentAge student_age = 17
Hint: Type the snake case version of the camel case name shown in the comment.

Spot the Error

Question 1
A first_name = 'Ava'
B lastName = 'Nguyen'
C print(first_name, last_name)
Line B — lastName is camelCase. Python variables use snake_case, so it should be last_name. The print line also expects last_name.
Question 2
A def get_total(price, qty):
B total_cost = price * qty
C return total_cost
D print(getTotal(2, 3))
Line D — The function is defined as get_total, but this call uses camelCase. Function names in snake_case must be called with the same name: get_total(2, 3).
Question 3
A score = 85
B bonus = 5
C total_score = score + bonus
D max_mark = 100
E print(total_score / MAX_MARK)
Line D — A constant should be written in UPPER_SNAKE_CASE, so it should be MAX_MARK. The lower case name also no longer matches the print line.
Question 4
A def get-average(marks):
B total = sum(marks)
C return total / len(marks)
Line A — Snake case joins words with underscores, not hyphens. A hyphen is the minus operator in Python, so the name should be get_average.
Question 5
A age = 16
B min_age = 15
C Is_Eligible = age >= min_age
D print(is_eligible)
Line C — Snake case uses only lower case letters. Is_Eligible has capitals, so it should be is_eligible, which is also the name used in print().

Student with a class code? Join your class →