Python小练习006

输出九九乘法表。

 1 #第一种显示方式
 2 row = 1
 3 
 4 while row <= 9:
 5     column = 1
 6     while column <= row:
 7         print(str(column) + "*" + str(row) + "=" + str(column * row), end="\t")
 8         column += 1
 9     print()
10     row += 1
11 
12 print("-" * 100)
13 #第二种显示方式
14 row = 9
15 
16 while row > 0:
17     column = 1
18     while column <= row:
19         print(str(column) + "*" + str(row) + "=" + str(column * row), end="\t")
20         column += 1
21     print()
22     row -= 1

运行结果如下:

 

posted @ 2018-03-28 20:09  Jysu  阅读(118)  评论(0)    收藏  举报