- Learn Python in 7 Days
- Mohit Bhaskar N. Das
- 145字
- 2021-07-09 20:40:22
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.
- JBoss Weld CDI for Java Platform
- 軟件安全技術(shù)
- AngularJS入門與進階
- Raspberry Pi Networking Cookbook(Second Edition)
- Access 數(shù)據(jù)庫應用教程
- Neo4j Essentials
- 表哥的Access入門:以Excel視角快速學習數(shù)據(jù)庫開發(fā)(第2版)
- Oracle GoldenGate 12c Implementer's Guide
- Node.js 12實戰(zhàn)
- 創(chuàng)意UI:Photoshop玩轉(zhuǎn)APP設(shè)計
- Machine Learning for OpenCV
- WordPress Search Engine Optimization(Second Edition)
- Mastering XenApp?
- C語言程序設(shè)計
- Mastering Machine Learning with scikit-learn