If/else statements
Conditional statements actually in the previous article we have used several times, here we need to re-grand to introduce it, conditional statements are judged by one or more statements of the return result (true or false) to choose to perform the next command, the more commonly used is the IF/ELSE statement, It can be expressed in code like this (pay attention to the direct indentation relationship of the statement OH):
Python code
If condition 1: Execute statement 1 Else: EXECUTE statement 2 if judgment Condition 2: Execute statement 3 else: EXECUTE statement 4
The execution logic of the if/else is that if the judgment condition after the if is fulfilled, the statement block of if is executed, otherwise the statement block of else is executed.
Now I'm going to do a simple task, using the IF Else statement to output the maximum between x and Y.
Think for a moment ~ ~ ~
For more information, please go to the code bud Net
Http://www.mayacoder.com/lesson/index
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/F2/wKiom1fPh8OhqDzsAAA-O9VXGZw593.png-wh_500x0-wm_3 -wmp_4-s_735511816.png "title=" 4.png "width=" "height=" 682 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:300px; height:682px; "alt=" Wkiom1fph8ohqdzsaaa-o9vxgzw593.png-wh_50 "/>
Python Beginner Learning Basics Conditional Statement--IF/ELSE statement