Python3 multiplication table (top to bottom + from bottom to top)

Source: Internet
Author: User

One, the use of knowledge points:

1. Use of variables.

2. Use of circular statements, here is a double while loop. Of course, it's also possible to use other loops to do it. I think the use of a double while loop is easier to understand for people who have just come into contact with programming.

3. Use the line break "\ n" and the tab "\ T" to make the output more beautiful

Second, the code:

1 Print("\ n"+"From top to bottom")2 3A1 = 14 5  whileA1 <= 9:6A2 = 17      whileA2 <=A1:8         Print(STR (A2) +"*"+STR (A1) +"="+str (A1*A2), end ="\ t")9a2 = a2 + 1Ten     Print() Onea1 = A1 + 1 A  - Print("######################################################################\n") -  the Print("From bottom to top") -  -A3 = 9 -  +  whileA3 >0: -a4 = 1 +       whileA4 <=A3: A          Print(str (A4) +"*"+STR (A3) +"="+str (A3*A4), end ="\ t") ata4 = A4 +1 -      Print("") -A3 = A3-1

Third, the effect output:

Python3 multiplication table (top to bottom + from bottom to top)

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.