Python Keywords and Identifiers (3rd part)
Here I published the 3rd part of the consecutive series about Python Programming language to learn for all. Please check the previous parts.
Previous
Python Programming Language (1st part)
Variables Assignment In Python Programming Language (2nd part)
Each Programming language has its own syntax and structure . To define these syntaxes and structure reserved words are used. Python Programming language is no exception. There are 35 keywords in Python 3.8, each serving a different meaning for a different purpose.
Every keyword is a part of the vocabulary of the Python Programming language. So we can't use these keywords for defining names of variables, classes or functions.
Python keywords are case sensitive, which means they must be written as they are while we using them in our code.
To get the keywords list, open Python IDLE (windows) and type "help()" and hit enter. Type "keywords", voila! you can see now the whole python keywords list.
We can also use Python's keyword module to get the list.
To know about a specific keyword and its usage, type its name on the help mode and hit enter.
Example of keyword :
Using “while” keyword we can run a loop in a code block for displaying the values of a variable.
a = 12
while a>3:
print(a)
a -= 1
Type on your Python IDLE and see.
Don't worry we will discuss details in the coming sections.
Python Identifiers
When we assign a name to a variable, function, class, module or any other programmable entity, then it is called an identifier.
Python language has a set of rules to create identifiers.
Rules:
- A valid identifier can only have a combination of letters either in lowercase(a to z) or uppercase(A to Z) or digits(0 to 9) or underscore (__).
num, num1, num_1, numTwo are valid identifiers example. - The name of an identifier can't start with a digit. For example:
1num is not a valid identifier name, but num1 is a valid one. - Keywords can't be used as valid identifiers' names.
- Avoid special characters ['$', '%', '.', '@', '!' ] for naming a valid identifier.
- A valid identifier can have an unlimited length of the sequence of the characters.
we should aware that Python language is case sensitive. So, the identifier 'name' and 'Name' are not the same.
........................................
I hope that dear readers understand what has been discussed so far about today's topic.
Next
Python Data Types
Leave Python Keywords and Identifiers (3rd part) to:
Read more #steem posts
Best Posts From Hive-blogger
We have not curated any of alrashel's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Hive-blogger
- Bioengineering: How It Enhances Photosynthesis and Increases Yields in Food Crops
- Every programmer needs to know the Algorithms
- The booting operations phase of the modern computer system
- A Modern Perspective Of Operating Systems
- Moved to the appropriate community!
- Trading in a smart way.
- A Popular Data Structure In Python Programming : The List
- Bitcoin Is Going To The Back Of Its Price
- Let's Destroy Racism
- Web3 Decentralized Apps Keep Quarantined During The Global Epidemic.
- The Ethereum Name Service (ENS)
- Ethereum Enhances Transaction Privacy
- Primitive and non-primitive data structures in Python
- Python Rules Of Coding: Docstrings
- Python Rules Of Coding: String literals
- Python Rules Of Coding: Comments
- Python Rules Of Coding: Naming Conventions
- JavaScript : The Scripting Language
- Python Rules Of Coding: Indentation
- Python Data Types (fourth part)