用for循环打印九九乘法表: for i in range (1,10): for j in range(1,10): print(j,"x",i,"=",i*j,"\t",end="") if i==j: print("") break 打印结果是: 1 x 1 = 1 1 x 2 = 2 2 x 2 = 4 1 x 3 = 3 2 x 3 = 6 3 x 3 = 9 1 x 4 = 4 2 x 4 =…
用for循环写出的九九乘法表(包括函数的调用) #方向一 for i in range(1,10): for j in range(1,i+1): d = i * j print('%d*%d=%-2d'%(i,j,d),end = ' ' ) print() 下图为上面代码运行结果: 以下为函数练习,函数和for循环结合的九九乘法表(没有上面的简洁明了)#方向一 def hanshu(n): m = n sums = 0 for j…