用Python语言编程,使用双重循环语句输出"九九乘法表". for i in range(1, 10): # 控制行 for j in range(1, i+1): # 控制列 print(j, 'x', i, '=', j*i, sep='', end='\t') # end='\t'相当于每次打印结束不换行,而是在末尾添加\t(tab): # 而sep=''表示每个打印的字符之间用''内的内容衔接,去掉默认带有的空格 print() # 每打印完一行就最最后打印一个空白,相当于屏…
# 1*1 = 1 # 1*2 = 2 2*2 = 4 # 1*3 = 3 2*3 = 6 3*3 = 9 i = 1 j = 1 for j in range(1,10): for i in range(1,j +1): print('%s*%s=%s '%(i,j,i*j),end='') # print(j,'*',i,'=',i*j,end = ' ') print('') 记录一下遇到的问题: 1. for i in j:#报错 TypeError: 'int' object is n…
python2.7 for i in range(1,10): for j in range(1,i+1): print j,'x',i,'=',j*i,'\t', print '\n'print '\nDone' python3.7 i = 1 while i<=9: j = 1 while j<=i: print ("%d*%d=%-2d "%(j,i,j*i),end="") j+=1 print(""…
正序: for i in range(1,10): for j in range(1,i+1): print(str(i)+"*"+str(j)+"="+str(i*j)+" ",end="") print() 逆序: a=9while a>0: for i in range(1,a+1): print(str(a)+"*"+str(i)+"="+str(a*i)+" &…
参考:http://www.cnblogs.com/suiy-160428/p/5594389.htmlpython输出 9*9 乘法口诀表 矩形输出九九乘法表: for i in range(1,10): for j in range(1,10): if i <= 9: print(f"{j}×{i} = {i * j}", end="\t") print("") 运行结果如下: 左下三角形式九九乘法表: for i in range(1…