Python (iv) generator and Yang Hui triangle

Source: Internet
Author: User

Learning Links:

Http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/ 0014317799226173f45ce40636141b6abc8424e12b5fb27000

Generator things are not very difficult, the main note under the list of the inside Listwy[-1] represents the last element of the list

Then the problem is difficult, I start to feel the mind

Practice

The Yang Hui triangle is defined as follows:

          1         /         1   1       / \ /       1   2   1     / \ / \ /     1   3   3   1   / \ / \ / \ /   1   4   6   4   1 / \ / \ / \ / \ / 1   5   10  10  5   1

Think of each line as a list, try writing a generator, and continuously output the list of the next line:

Python (iv) generator and Yang Hui triangle

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.