650) this.width=650; "src=" HTTP://SI1.GO2YD.COM/GET-IMAGE/0BEEE59TEM8 "style=" border:0px;margin:20px 0px; "alt=" 0beee59tem8 "/>
Article | Sugar Bean Chart | Source Network
Sugar Beans Intimate Reminder, this article reading time 3 minutes, the end of the text has a secret!
Python conditional statements
A python conditional statement determines the code block that executes by executing the result of one or more statements (true or false).
You can easily understand the execution of conditional statements by:
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0BEEEN3S3xw "style=" border:0px;margin:20px 0px; "alt=" 0beeen3s3xw "/>
The Python program language specifies any non-0 and non-null (NULL) values of true,0 or NULL to FALSE.
In Python programming, if statements are used in the execution of control programs, in the basic form:
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0BEEEK3SuMy "style=" border:0px;margin:20px 0px; "alt=" 0beeek3sumy "/>
Where the "judging condition" is established (not 0), the following statements are executed, and the execution content can be multiple lines, in order to be indented to differentiate the same range.
Else as an optional statement, you can execute the relevant statement when you need to execute the content when the condition is not true, as shown in the following example:
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0BEEEFqxGoS "style=" border:0px;margin:20px 0px; "alt=" 0BEEEFqxGoS "/>
The output is:
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0BEEEEN2KXI "style=" border:0px;margin:20px 0px; "alt=" 0beeeen2kxi "/>
The judgment condition of the IF statement can be expressed by > (greater than), < (less than), = = (equals), >= (greater than or equal), <= (less than or equal).
When judging a condition as multiple values, you can use the following form:
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0BEEEBWrHIe "style=" border:0px;margin:20px 0px; "alt=" 0BEEEBWrHIe "/>
Examples are as follows:
650) this.width=650; "src=" http://si1.go2yd.com/get-image/0BEEE7gQTJ2 "style=" border:0px;margin:20px 0px; "alt=" 0beee7gqtj2 "/>
The output is:
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0BEEEANXYzA "style=" border:0px;margin:20px 0px; "alt=" 0BEEEANXYzA "/>
Since Python does not support switch statements, multiple conditions can only be determined by elif, and if the judgment requires multiple conditions to be judged at the same time, the or (or) is used to indicate that two conditions have a successful condition when they are established; When using and (and), Indicates that only two conditions have been established at the same time, the judgment condition succeeds.
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0BEEEDSnpK4 "style=" border:0px;margin:20px 0px; "alt=" 0beeedsnpk4 "/>
If there are multiple conditions, you can use parentheses to distinguish the order of judgment, the judgment in parentheses precedence, and the priority of and and or is lower than > (greater than), < (less than), such as the judgment symbol, that is, greater than and less than in the absence of parentheses will be compared with or priority to judge.
Simple Group of statements
You can also use the IF condition judgment statement on the same line, as in the following example:
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0BEEEIbuyCO "style=" border:0px;margin:20px 0px; "alt=" 0BEEEIbuyCO "/>
The above code executes the output as follows:
650) this.width=650; "src=" HTTP://SI1.GO2YD.COM/GET-IMAGE/0BEEEHB1CDK "style=" border:0px;margin:20px 0px; "alt=" 0beeehb1cdk "/>
650) this.width=650; "src=" Http://si1.go2yd.com/get-image/0B2ythqvjDE "style=" border:0px;margin:20px 0px; "alt=" 0b2ythqvjde "/>
This article is from the "Marco Linux Training" blog, so be sure to keep this source http://mageedu.blog.51cto.com/4265610/1900498
Python conditional statements