← VCE Applied Computing U1O2

Python snake_case naming

A naming style where all letters are lowercase and words are joined by underscores, like student_score. Python uses it for variables and functions, and it should be used consistently.

Understanding Python snake_case naming in VCE Applied Computing U1O2

What it does: first_name separates words with an underscore, while firstName uses a capital letter, which is camelCase. Both variable names use snake_case, so the program keeps one consistent style and is easier to read and maintain. Python functions use lowercase words joined by underscores, so calculate_average() is correct.

Common mistakes: studentScore is camelCase. Python style uses snake_case for variables, so it should be student_score = 85. Line 3 also uses student_score, so the names would not match. Python function names should use snake_case, not camelCase. The line should be def get_average(marks):.

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 8–88) and word search (Modules 8–124).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which variable name follows Python snake_case style?
student_scorestudentScore
Matches
studentScore = 85
↓
This uses camelCase, but Python style expects snake_case. It should be student_score.
Applying
Meanings
Term
snake_case
Meaning
A naming style where all letters are lowercase and words are joined by underscores, like student_score. Python uses it for variables and functions, and it should be used consistently.
Practice
student_score = 85
Testing
Gaps
= 85
Check Answer
Spots
1pass_mark = 50
2studentScore = 85

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

The 'Tree Frog' badge — Leap of Logic, 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 follows Python snake_case style?
A. studentScore
B. student_score ✓
snake_case uses lowercase words joined by underscores. studentScore is camelCase.
2. Which function name follows Python snake_case style?
A. calculate_average() ✓
B. CalculateAverage()
Python functions use lowercase words joined by underscores, so calculate_average() is correct.
3. True or false: snake_case names can contain capital letters in the middle of the name.
A. False ✓
B. True
snake_case uses all lowercase letters. Capital letters in the middle of a name belong to camelCase.
4. A programmer's Python program already uses total_cost and item_count. Which name should they choose for a new variable?
A. discountRate
B. discount_rate ✓
Following one style consistently makes code easier to read and maintain, so the new variable should also use snake_case.
5. Which character joins the words in a snake_case name?
A. An underscore _ ✓
B. A hyphen -
snake_case uses underscores. A hyphen is read as a minus sign in Python, so first-name would not work as a variable name.

Match the Pairs

student_score = 85 → A Python variable named in snake_case: lowercase words joined by underscores
def calculate_total_marks(): → A Python function named in snake_case so it follows the standard Python style
snake_case is different from camelCase because it uses underscores instead of capital letters to separate words → first_name (not firstName)
Follow one naming style consistently so every variable in a program is easy to read → total_marks = 0 average_mark = 0
studentScore = 85 → This uses camelCase, but Python style expects snake_case. It should be student_score.
total_marks = 90 bonusPoints = 5 → The styles are mixed. bonusPoints is camelCase and should be bonus_points to match total_marks.

Key Term

snake_case
A naming style where all letters are lowercase and words are joined by underscores, like student_score. Python uses it for variables and functions, and it should be used consistently.

Fill in the Blanks

1. student_score = 85 print(student_score)
Hint: Type the variable name in snake_case, matching the one printed on the next line.
2. def calculate_average(total, count): return total / count avg = calculate_average(240, 3)
Hint: Type the function name in snake_case, matching the name used when it is called on line 3.
3. last_name = "Nguyen" full_name = "Ava " + last_name
Hint: Type the variable name in snake_case, matching the one used on line 2 to build the full name.
4. def get_total_points(points): return sum(points)
Hint: Type the keyword that starts a function definition in Python.
5. high_score = 0 if new_score > high_score: high_score = new_score
Hint: Type the snake_case variable that stores the best score so far, matching the name compared and updated below.

Spot the Error

Question 1
A pass_mark = 50
B studentScore = 85
C if student_score >= pass_mark:
D print("Pass")
Line B — studentScore is camelCase. Python style uses snake_case for variables, so it should be student_score = 85. Line 3 also uses student_score, so the names would not match.
Question 2
A def getAverage(marks):
B total = sum(marks)
C return total / len(marks)
Line A — Python function names should use snake_case, not camelCase. The line should be def get_average(marks):
Question 3
A first_name = "Ava"
B last_name = "Nguyen"
C full_name = first_name + " "
D fullName += last_name
E print(full_name)
Line D — The variable was created as full_name, but this line uses camelCase fullName. Stay consistent with one style: full_name += last_name.
Question 4
A num_sold = 12
B unit_cost = 4
C total = num_sold * unit-cost
D print(total)
Line C — A hyphen is not allowed in a variable name. Python reads unit-cost as unit minus cost. Words must be joined with an underscore: unit_cost.
Question 5
A def show_total(item_count):
B price = 3
C cost = itemCount * price
D return cost
Line C — The parameter is named item_count in snake_case, but this line uses camelCase itemCount. It should be cost = item_count * price.

Student with a class code? Join your class →