Page 424 - CITS - Computer Software Application -TT
P. 424
COMPUTER SOFTWARE APPLICATION - CITS
Examples of valid variable names are:
student_name
_student_name
Student_name
studentname
studentName
studentName1
STUDENTNAME_
Examples of invalid variable names are:
1studentName
student@name
student name
student-name
1studentName is invalid because variable names cannot start with a digit.
student@name is invalid because variable names cannot have any special characters except the underscore
character.
student name is invalid because variable names cannot have any space characters.
student-name is invalid because hyphens are not allowed.
The general naming convention in Python when it comes to variable names, is to use lowercase alphabets and
separate each word using the underscore character_.
The camelCase
However, many Python software developers use the camelCase instead of the lowercase separated by the
underscore character.
camelCase refers to variable names starting with a lowercase character, and instead of using the underscore
character _ to separate 2 words, it starts the next word with an uppercase character.
It is important to note that regardless of whether we use lowercase with underscore character _ or camelCase, we
should be consistent and adopt the same naming convention throughout our program.
And variable names are case- sensitive:
student_name is not the same as STUDENT_NAME
411
CITS : IT&ITES - Computer Software Application - Lesson 120 - 137 CITS : IT&ITES - Computer Software Application - Lesson 120 - 137