
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 :



Originally published at https://hive.blog on April 27, 2020.