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

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.

主站蜘蛛池模板: 博兴县| 衡水市| 偃师市| 铁力市| 无为县| 星子县| 漾濞| 南岸区| 华容县| 沧州市| 福建省| 炉霍县| 江阴市| 义乌市| 广汉市| 秭归县| 万荣县| 同仁县| 山丹县| 永胜县| 康定县| 阿巴嘎旗| 临桂县| 佳木斯市| 自贡市| 城步| 和田市| 盐津县| 合作市| 枞阳县| 伊宁县| 元阳县| 田林县| 宿松县| 中牟县| 麟游县| 武定县| 应城市| 昌江| 建德市| 呼伦贝尔市|