python 99乘法表

来源:互联网 发布:优化游戏的软件 编辑:程序博客网 时间:2024/05/19 12:16

#for 9*9乘法表 

for i in range(1,10):

     for j in range(1,i+1):
         print '%s x %s = %s'%(i,j,str(i*j)),
    print


# while  9*9乘法表
 i = 1
 while i < 10:
     j = 1
     while j < (i+1):
         print '%s x %s = %s' % (i, j, str(i * j)),
         j += 1
         continue
     i += 1
     print
原创粉丝点击