Python Rules Of Coding: Indentation
Previous
Python Data Types
Introduction :
For Python coding rules we follow Python's style guide known as PEP-8. Python Enhancement Proposal or PEP-8 has given the main focus on code to readability.
Although Python is relatively easy to learn than another programming language, it is important and a little bit hard to deal to know how to express better with the Python language.
Python language has a philosophy.
It can be seen when we type "import this" on Python IDLE.
So 'Readability issues' should be our main concern while writing Python code. For this why, we should be obedient to PEP-8.
We can check whether our code complies with these rules using the Python style checker .
Python Rules Of Coding
Table Of Contents
- Indentation
- Naming Conventions
- comments
- String Quotes
- User Documentation
Indentation :
Indentation gets extra importance while coding python programming.
According to the Python style guide, the indentation should be 4 spaces per indentation level.
Look at below, here 'if' with 'print' statement is indented with 4 spaces -
Multi-line expressions don't follow 4-spaces. Multi-lines expression should be aligned vertically which is known as “hanging indent”.
The below examples from PEP 8 -- Style Guide for Python Code :
Next
Python Rules Of Coding: Naming Conventions
Leave Python Rules Of Coding: Indentation to:
Read more #stem 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)