DEV Community

Punitha
Punitha

Posted on

Variables/Identifiers

What is a Variables?

A Variables is a container used to store data values in program.
Example:

name = "Python"
age = 21
Enter fullscreen mode Exit fullscreen mode

Variable Naming Conventions:

  • Can contain letters, numbers, and underscore(_)
  • Must start with a letter or underscore
  • Cannot start with a number
  • Cannot contain spaces
  • Cannot use Python keywords
  • special characters are not allowed

Multi-words Variable Names:

  • Camel Case - Each word except the first, start with a capital letter.

Example:

studentName
employeeSalary
Enter fullscreen mode Exit fullscreen mode
  • Pascal Case - Each word start with a capital letter.

Example:

StudentName
EmployeeSalary
Enter fullscreen mode Exit fullscreen mode
  • Snake Case - each word is separated by an underscore character.

Example:

student_name
employee_salary
Enter fullscreen mode Exit fullscreen mode

Top comments (0)