python九九口訣表

發佈第一篇隨筆,測試代碼發佈效果測試

測試代碼:九九口訣表spa

 1 # 1*1=1
 2 # 1*2=2 2*2=4
 3 # 1*3=3 2*3=6 3*3=9
 4 # 1*4=4 2*4=8 3*4=12 4*4=16
 5 #定義橫豎座標
 6 row = 1
 7 col = 1
 8 #循環體
 9 while col <= 9: 10     while row <= col: 11         print("%d*%d=%d"% (row,col,row*col) ,end="\t") 12         row +=1
13     col +=1
14     row = 1
15     print("")
相關文章
相關標籤/搜索