1. Statements are executed on a line-by-row basis, unless you do not write
If the statement uses an if statement, his execution is jumping, and the IF statement is the process control
2. Automatic boundary detection of blocks and statements
Because Python does not have curly braces for these bounding symbols, it uses code indentation to control boundaries
Similarly, the end of a statement is not using semicolons, but also using code indentation
In the above example, for the indentation before the for, its scope is only within the function of Printnum, and the indentation before print, which represents the scope of print only in for, does not work outside
3. Compound statement end uses a semicolon, the execution statement inside the compound statement is called block or group, must be indented in the conforming statement
>>> def testif (param): If param<1:print ("input number less than 1") Elif 1<param<3:print ("number entered between 1 and 3") Else:print ( "Number entered is greater than 3")
4. Blank lines, spaces, comments are ignored
Once again we cite the above example, please note: I added a note after the Testif, in the first sentence I added a blank line before the colon before the if I added a space, but these are ignored in the program
5. The document string will be ignored but will be saved with the tool display
Right here, thank you.
------------------------------------------------------------------
Click to jump 0 basic python-Catalogue
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
0 Fundamentals python-11.2 Python grammar Rules