- 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.
- AngularJS入門與進階
- Python科學計算(第2版)
- MySQL 8從入門到精通(視頻教學版)
- JavaScript:Functional Programming for JavaScript Developers
- C++面向對象程序設計(微課版)
- Python從菜鳥到高手(第2版)
- PyTorch Artificial Intelligence Fundamentals
- Vue.js 3.0源碼解析(微課視頻版)
- Learning Informatica PowerCenter 10.x(Second Edition)
- 深入淺出RxJS
- Android底層接口與驅動開發技術詳解
- 深入分布式緩存:從原理到實踐
- UVM實戰
- JSP程序設計實例教程(第2版)
- Nagios Core Administration Cookbook(Second Edition)