#本文仅为个人学习过程的整理和记录, if there is a blog from others, the site extracts the content, I will clearly mark, if there is infringement, please contact me, I will be deleted in the first time.
The following information is compiled from the (1) Liaoche python tutorial http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000
(2) Concise python tutorial http://woodpecker.org.cn/abyteofpython_cn/chinese/
1. Process Control
(1) If statement
1) The If statement contains a logical expression, using an expression comparison, to make a decision based on the results of the comparison.
2) If expression:
Statement (s)
Note: Python uses indentation as a method of grouping its statements, and it is recommended to use 4 spaces instead of indents
3) The logical value (BOOL) is used to denote such concepts as: Right and wrong, true and false, empty and non-empty.
The logical value consists of two values:
True: Indicates non-empty quantities (e.g. string,tuple,list,set,dictonary, etc.), all non-zero
False: Indicates 0,none, empty amount, etc.
Function: Mainly used in interpreting sentences for judging
Whether a string is empty
Whether the result of an operation is zero
Whether an expression is available
(2) Else statement:
If expression:
Statement (s)
Else
Statement (s)
If the conditional expression if statement resolves to a value of 0 or FALSE, the Else statement is executed.
Else statement is an optional statement that cannot be used alone and can have at most one else statement
(3) elif statement:
If expression:
Statement (s)
Elif expression2:
Statement (s)
Elif Expression3:
Statement (s)
Else
Statement (s)
The Elif statement can check that multiple expressions are true and executes a block of code, and the Elif statement is optional. There can be any number of elif statements.
Python learning log for small y-data type (if loop)