Python script to write a multiplication table

Source: Internet
Author: User
Tags python script

When learning scripts, you will often be asked if you would write a 99 multiplication table, and now simply write a multiplication table with a Python statement

[email protected] python_py]# Cat While3.pyi = 1while (i<=9): J=1 while (j<=i): PRINTJ, "X", I, "=", j*i, "\ t", j=j+1 print "" I= i+1

Test:

[[email protected] python_py]# python while3.py 1 x 1 = 1   1 x 2 = 2 2 x 2 = 4  1 x 3 =  3 2 x 3 = 6 3 x 3 = 9  1 x 4 =  4 2 x 4 = 8 3 x 4 = 12 4 x 4 =  16  1 x 5 = 5 2 x 5 = 10 3 x 5  = 15 4 x 5 = 20 5 x 5 = 25  1 x  6 = 6 2 x 6 = 12 3 x 6 = 18 4 x  6 = 24 5 x 6 = 30 6 x 6 = 36  1  x 7 = 7 2 x 7 = 14 3 x 7 = 21 4  x 7 = 28 5 x 7 = 35 6 x 7 = 42 7 x 7 = 49   1 x 8 = 8 2 x 8 = 16 3 x 8 = 24  4 x 8 = 32 5 x 8 = 40 6 x 8 = 48  7 x 8 = 56 8 x 8 = 64  1 x 9 =  9 2 x 9 = 18 3 x 9 = 27 4 x 9 =  36 5 x 9 = 45 6 x 9 = 54 7 x 9 =  63 8 x 9 = 72 9 x 9 = 81



This article is from the "First Legehappy51cto blog" blog, be sure to keep this source http://legehappy.blog.51cto.com/13251607/1981457

Python script to write a multiplication table

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.