官术网_书友最值得收藏!

Indentation

The most unique characteristic of Python, unlike other programming languages, is indentation. Indentation not only makes Python code readable, but also distinguishes each block of code from the other. Let's explain this with an example:

def fun():
pass
for each in "Australia":
pass

While writing the code, a new block of code starts with a colon followed by a tab. Here, after the function fun(), a colon is provided which will start the function body, pass is part of the function fun() and it is placed at one tab space. Likewise, the for loop starts with a colon. Here, most people get confused whether to use a tab or space. It is advisable to stick to only one type and follow the same across the whole code. If the indentation is not strictly implemented, then code execution will throw an error.

主站蜘蛛池模板: 高要市| 金华市| 胶南市| 甘泉县| 阿拉善左旗| 齐齐哈尔市| 宁海县| 新津县| 都匀市| 惠州市| 鹤壁市| 固原市| 南康市| 始兴县| 三江| 新余市| 且末县| 河南省| 松桃| 余姚市| 徐州市| 涟水县| 大同县| 新绛县| 昭平县| 揭东县| 乌拉特中旗| 浮山县| 金门县| 绥阳县| 湖北省| 新营市| 普格县| 桦甸市| 邢台市| 栖霞市| 射洪县| 佛冈县| 镇宁| 额尔古纳市| 平潭县|