1. Identifiers in Python:
A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9).
Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language. Thus, Manpower and manpower are two different identifiers in Python.
2. Literals in Python:
3. Variable in Python:
A Python variable is a memory space allocated for storing values. A variable, in other words, provides data to the computer for processing.
In Python, each value has a datatype. Different data types in Python are Numbers, List, Tuple, Strings, Dictionary, etc. Variables can be declared by any name or even alphabets with Naming Convention Rules.
The Naming Convention Rules are:
1. Variable name should start with letter(a-zA-Z) or underscore (_).
Valid : age , _age , Age
Invalid : 1age
2. In variable name, no special characters allowed other than underscore (_).
Valid : age_ , _age
Invalid : age_*
3.Variables are case sensitive.
age and Age are different, since variable names are case sensitive.
4.Variable name can have numbers but not at the beginning.
Example: Age1
5.Variable name should not be a Python keyword. Keywords are also called as reserved
words.
Example
pass, break, continue.. etc are reserved for special meaning in Python. So, we should not declare keyword as a variable name.
4. Keywords in Python:
Here is a list of the Python keywords. Enter any keyword to get more help.
False class from or
None continue global pass
True def if raise
and del import return
as elif in try
assert else is while
async except lambda with
await finally nonlocal yield
break for not