0 Fundamentals python-11.2 Python grammar Rules

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.