Exercise while learning Python - multiplication table

Results are as follows:

 

Implementation code;

m =. 1 
n-=. 1
the while (m <10):
the while (n-<= m):
Print (n-, "*", m, "=", m * n-, End = '\ T')
n-+ =. 1
Print ( '\ n-')
n-1 =
m + 1 =

Resolution:
  this is a very simple while nesting program first analyzes the multiplication table row increases from the top down, and the product of the first column 1 product (1 and multiplying the number of each).
  The number of layers other than the determination has several product lines. In front of the display is not important, the required form, the inner layer can be printed first.
  Concern is, print statements comes with wrap effect, that is, print ( "hello world") actually print ( "hello world", end = '\ n'), so the program will need to output multiple peer-end print character change (any character can also be empty (not spaces)) for the other characters
chose "\ t" is due because the output is a product of some of some of two, it will be printed unaligned, while " \ t "tab means, similar to the key function table, is automatically aligned (when not much difference between the number of bits)

Guess you like

Origin www.cnblogs.com/zhurs/p/11520056.html