For building a house, foundation is most important..Likewise learning programming basics are most essential.So,have a glance at the article which is about the basics of python keywords and identifiers which is going be used always in programming.(basic to advanced level)
Keywords are the reserved words in Python.
In Python, keywords are case sensitive.
There are 33 keywords in Python 3.7. This number can vary slightly over the course of time.
All the keywords except
None are in lowercase and they must be written as they are. The list of all the keywords is 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.
An identifier is a name given to entities like class, functions, variables, etc. It helps to differentiate one entity from another.
Rules for writing identifiers
- Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore
_. Names like
print_this_to_screen, all are valid example.
- An identifier cannot start with a digit.
1variableis invalid, but
variable1is a valid name.
- Keywords cannot be used as identifiers.
global = 1
File "<interactive input>", line 1 global = 1 ^ SyntaxError: invalid syntax
4.We cannot use special symbols like !, @, #, $, % etc. in our identifier
a@ = 0
File "<interactive input>", line 1 a@ = 0 ^ SyntaxError: invalid syntax
5.An identifier can be of any length.
Things to Remember
Python is a case-sensitive language. This means,
variable are not the same.
Always give the identifiers a name that makes sense. While
c = 10 is a valid name, writing
count = 10 would make more sense, and it would be easier to figure out what it represents when you look at your code after a long gap.
Multiple words can be separated using an underscore, like