In this post, you will learn about Python keywords and python identifiers.
Python Keywords are those which are reserverd by Python. You can not use it as variable, class or function name.
Python keywords are case sensitive. True, False and None are in uppercase all others are in lowercase.
There are total 33 keywords but it can vary.
Here is list of all 33 keywords.
Identifier is the name given to class, function or variable, so we can provide any name for Python identifier.
Rules for Python identifier:
There are some rules which we need to follow for python identifers.
Identifier can be any combinations of uppercase, lowercase and underscore(_).
You can not use special characters such as @!*&^%$ etc.
Identifier can be of any length.
You can not start identifier with a number. For example: 1count is invalid identifer and count1 is valid one.
But here are some tips for python identifiers.
Always try to provide more informative name, for example: count=1 is much better than c=1
Always use first letter with upper case for class.
Always use first letter with lowercase for functions, methods.
You can use camelcase (Using uppercase for separation of words).e.g use countOfFruits to separate count of fruits.
That’s all about Python keywords and identifiers.