1. The script is as follows
(1) Inverted triangular format, note the space before the line
For I in Range (1,10):
For j in Range (i,10):
Print ("%d*%d=%d"% (i,j,i*j), end= "")
Print ("")
(2) Rectangular format
For I in Range (1,10):
For j in Range (1,10):
Print ("%d*%d=%2d"% (i,j,i*j), end= "")
Print ("")
(3)
Rectangular format
For I in Range (1,10):
For j in Range (1,10):
Print ("%d*%d=%d"% (i,j,i*j), end= "")
Print ("")
(4) Other formats
For I in Range (1,10):
For j in Range (1,10):
Print ("%d*%d=%d"% (i,j,i*j))
Print ("")
Summarize:
1, inverted triangle and rectangle difference lies in the range of J, when J in Range (i,10):, at this time, each time the loop is executed, I increase at the same time, J also increased, but if J in range (1,10), each time, J is from 1 to 9 execution once
2, end= "", pass an empty string for end end, so that the print function does not add a line break at the end of the string, but instead adds an empty string. This only works with version 3. 2.* Version not supported
3, the last line print (""), the main role of line-wrapping
Python Output 99 multiplication table