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

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.

主站蜘蛛池模板: 克拉玛依市| 崇明县| 嘉禾县| 民和| 合阳县| 肥西县| 株洲市| 濮阳县| 安义县| 庄河市| 吉隆县| 且末县| 稻城县| 岳阳县| 时尚| 左云县| 枞阳县| 青阳县| 吴忠市| 仙桃市| 灵山县| 宁陵县| 筠连县| 纳雍县| 云南省| 南陵县| 绍兴县| 壶关县| 永昌县| 永兴县| 金山区| 化隆| 共和县| 保康县| 宁晋县| 太原市| 新建县| 锦州市| 乌拉特中旗| 磐石市| 城口县|