Aqua Wood Confession Studio: Starting from 0 python-Grammar chapter (i)

Source: Internet
Author: User

The so-called understanding, is to really integrate, otherwise stuffed in the brain of knowledge, is also dead.

Preface: This is their own way of learning, through the record notes to arrange ideas, there is no place please more advice ~

Python Basic Syntax

Python is a high-level scripting language that combines explanatory, compiled, interactive, and object-oriented.

Python's design is highly readable, with English keywords often used in other languages, some punctuation in other languages, and it has a more distinctive grammatical structure than other languages.

Yes

Python writes code in a way that acts like a C,c++,java , and that it works the same way:

1 Print (' Hello! Python'); Print ('hello! Python')2'Monday, Tuesday, Sunday'3  print(days)

Run:

Empty line for Python:

A blank line separates between functions or methods of a class, representing the beginning of a new piece of code. The class and function entries are also separated by a line of blank lines to highlight the beginning of the function entry.

Blank lines are different from code indentation, and empty lines are not part of the Python syntax. When you write without inserting a blank line, the Python interpreter runs without errors. However, the purpose of a blank line is to separate the code of two different functions or meanings, which facilitates the maintenance or refactoring of future code.

Remember: Blank lines are also part of program code

Quotation marks for Python:

Python can use ', ', ', ' to represent a string, where ' ' ' can be used as an annotation.

Notes for Python:

Single-line comments can use #, and multiline annotations can use "".

The indentation in Python

The biggest difference between python and other languages is that instead of using {} to control classes, functions, and other logical judgments, Python has the most characteristic of using indentation to write modules.

Note: The amount of whitespace to indent is variable, but all code block statements must contain the same amount of indentation whitespace, which must be strictly enforced.

The above three code shows:

1 test = 12if  test:3     print (' I'm da!  ')4     print ('KISS me! ' )5Else  :6     print (' hehe Hey!  ')

Run:

Aqua Wood Confession Studio: Starting from 0 python-Grammar chapter (i)

Related Article

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.