snake_case

noun

say it: “SNAYK KAYS” /ˈsneɪk ˈkeɪs/

The way Python names variables and functions: all lowercase letters, with an underscore between words, such as total_price.

What is snake_case?

snake_case is how Python names variables and functions: all lowercase, with underscores between the words.

first_name = "Ava"
total_price = 42.0

def send_welcome_email():
    print("Welcome aboard!")

In a sentence

  • “PEP 8 asks for snake_case, so TotalPrice became total_price.”
  • “send_welcome_email is written in snake_case.”

Level: Novice · More Python terms at this level

Updated