欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

打印九九乘法表

程序员文章站 2022-05-23 21:55:55
1 line =9 2 while line >0: 3 #print ("*") 4 tmp =line 5 while tmp >0: 6 print ("#",end="") 7 tmp-=1 8 line -=1 9 print() 10 11 first =0 12 while first ......
 1 line =9
 2 while line >0:
 3     #print ("*")
 4     tmp =line
 5     while tmp >0:
 6         print ("#",end="")
 7         tmp-=1
 8     line -=1
 9     print()
10     
11 first  =0
12 while first <=9:
13     sec =1
14     while sec <= first:
15         print (str(sec) + "*" + str(first) + "=" +str(sec * first) , end ="\t")
16         sec +=1
17     first +=1
18     print ()