python conditional statement

# Conditional (IF) statement: 
# Syntax. 1: if conditional expression: single statement 
# Syntax 2: if conditional expression: 
#               code block (multi-line statements) 

# execution of the process: if statements, when executed, will first of Analyzing the condition expression is evaluated, 
#    If True, after the statement is executed if 
#    If False, not performed 

NUM = 10
 if NUM> 8: Print ( ' NUM large than 8 ' ) 

if NUM> 8 :
     Print ( ' code block output line of the first ' )
     Print ( ' code block output a second row ' )
     Print ( ' code block third output lines ' )

IF 2 <NUM <20: Print ( " NUM is greater than 2 is less than 20 ' )

# Code block start indented, indentation level before the end of the code until the return to 
# indentation in two ways, one is to use the tab key, is to use the space (four) 
#    official documents Python's recommendation we use spaces to indent 
#    indenting Python code used must be unified 
#    the tab key to move to the space key "translate_tabs_to_spaces": true, = "according to the actual situation

 

Guess you like

Origin www.cnblogs.com/FlyingLiao/p/11129786.html