Furious Python-Article 3-Structure Control, Article 3 structure of python

Source: Internet
Author: User

Furious Python-Article 3-Structure Control, Article 3 structure of python

As we all know, the structure of program statement execution is nothing more than the sequential structure, branch structure, and loop structure. The same is true for Python, and the sequence structure is too simple to mention, briefly record the similarities and differences between branches and loops and C ++. By the way, for those who already know C ++, it should be noted that the statement block is controlled by indentation when learning Python.

Branch Structure: If and else are used, and an additional elif is used to replace the else if of C ++. The essence is the same, so no example is given.

Loop Structure: Compared with C ++, do does not exist .. the until statement, including the while and for statements, uses break to end the loop and uses continue to enter the next loop. However, the for statement and a new statement pass are different. The following is an example, other parts are the same.

For I in 'wyp': # print 'this is 'cyclically through the sequence structure, ifruits = ['apple', 'Banana', 'Orange '] for fruit in fruits: # print 'this is ', fruitfor I in range (3) through the sequence structure: # print 'index for' cyclically through the Index ', fruits [I] pass # pass won't do anything. It's useless.

 


What is the difference between the third and fourth versions of the Python learning manual? Help

The third version is python2.x, supplemented by 3. x. The fourth version is dominated by 3. x and supplemented by 2. x.

How to learn the English version of PYTHON 3

The book is good, but the third edition is a bit old. We recommend that you read the fourth edition, covering more new things. it is easy to understand and easy to understand. it seems that the author is familiar with c/c ++ ......

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.