Keywords are the reserved words in Python.
In Python, keywords are case sensitive.
There are 33 keywords in Python 3.3. This number can vary slightly in course of time.
All the keywords except
None are in lowercase and they must be written as it is. The list of all the keywords are given below.
Looking at all the keywords at once and trying to figure out what they mean might be overwhelming.
If you want to have an overview, here is the complete list of all the keywords with examples.
Identifier is the name given to entities like class, functions, variables etc. in Python. It helps differentiating one entity from another.
print_this_to_screen, all are valid example.
1variableis invalid, but
variable1is perfectly fine.
>>> global = 1 File "<interactive input>", line 1 global = 1 ^ SyntaxError: invalid syntax
>>> a@ = 0 File "<interactive input>", line 1 a@ = 0 ^ SyntaxError: invalid syntax
Python is a case-sensitive language. This means,
variable are not the same. Always name identifiers that make sense.
c = 10 is valid. Writing
count = 10 would make more sense and it would be easier to figure out what it does even when you look at your code after a long gap.
Multiple words can be separated using an underscore,
We can also use camel-case style of writing, i.e., capitalize every first letter of the word except the initial word without any spaces. For example: