大头目 发表于 2018-2-13 15:12:45

for i in range(1,10):
        for j in range(1,10):
                if i<=j:
                        print(i,'*',j,'=',i*j)

qtdfyz 发表于 2018-2-13 15:55:13

for i in range(10):
    for j in range(1,i+1):
      print('%s * %s = %s    ' % (j,i,i*j), end='')
    print('\n')

凌九霄 发表于 2018-2-13 16:27:05

for i in range(1,10):
    for j in range(1,i + 1):
      print("{0}X{1}={2}".format(j,i,i*j),end = ' ')
    print()

ultraji 发表于 2018-2-20 08:48:26

for x in range(1,10):
    for y in range(1,x+1):
      print ("{0}*{1}={2:2d}".format(y,x,x*y),end=' ')
    print()

lchelement 发表于 2018-2-25 11:21:20

'''输出99乘法口诀表
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9'''

for i in range(1,10):#行
    for j in range(1,i+1):#列
      result = i*j
      print('%d*%d=%d'%(j,i,result),end='\t')
    print()

纳兰小寒 发表于 2018-2-25 15:17:33

for x in range(1,10):
    for y in range(1,x+1):
      print('{0} x {1} = {2}\t'.format(y,x,x*y),end='')
    print()

强硬态度 发表于 2018-2-28 19:53:44

#九九乘法表
for i in range(1,10):
    for j in range(1,i+1):
      print("{} * {} = {}\t".format(j,i,i*j),end = "")
    if i == j :
      print("\r")
print()

victor.xu 发表于 2018-3-2 13:24:56

本帖最后由 victor.xu 于 2018-3-2 13:37 编辑

i = 1
j = 1
while i <= 9:
    for j in range(1,i+1):
      print('%s * %s = %s' %(i, j, i * j))
    j = 1
    i += 1
修改了一下
i = 1
j = 1
while i <= 9:
    for j in range(1,i+1):
      print('%s * %s = %s' %(i, j, i * j), end = '')
      if j == i:
            print('\n')
    j = 1
    i += 1

效果:
1 * 1 = 1

2 * 1 = 22 * 2 = 4

3 * 1 = 33 * 2 = 63 * 3 = 9

4 * 1 = 44 * 2 = 84 * 3 = 124 * 4 = 16

5 * 1 = 55 * 2 = 105 * 3 = 155 * 4 = 205 * 5 = 25

6 * 1 = 66 * 2 = 126 * 3 = 186 * 4 = 246 * 5 = 306 * 6 = 36

7 * 1 = 77 * 2 = 147 * 3 = 217 * 4 = 287 * 5 = 357 * 6 = 427 * 7 = 49

8 * 1 = 88 * 2 = 168 * 3 = 248 * 4 = 328 * 5 = 408 * 6 = 488 * 7 = 568 * 8 = 64

9 * 1 = 99 * 2 = 189 * 3 = 279 * 4 = 369 * 5 = 459 * 6 = 549 * 7 = 639 * 8 = 729 * 9 = 81

benzhj 发表于 2018-3-8 12:12:33

for i in range(1, 10):
    for j in range(1, i+1):
      print("{}*{}={}".format(i, j, i*j), end='\t')
    print()

zxw920506 发表于 2018-3-22 09:30:53

for x in range(1,10):
    for y in range(1,x+1):
      print('%d * %d = %2d'%(x,y,x*y),end=' ')
    print()

tsembrace 发表于 2018-4-7 11:38:25

#输出 9*9 乘法口诀表。
for i in range(1,10):
    for j in range(1,i+1):
      print('%2d*%2d=%2d' %(j,i,i*j),end='')
    print()

小强工作室 发表于 2018-4-17 10:46:02

for i in range(1,10):
    for j in range(1,i+1):
      print(str(j) + str("*") + str(i)+"=" + str(i*j),end="\t")#/t横向制表
    print()

萧丹夜 发表于 2018-5-8 20:18:19

for i in range(1,10):
    for j in range(1,10):
      print('%d*%d=%d' %(i,j,i*j),end='\t')
    print('\n')

夏未至夜未央 发表于 2018-5-8 20:50:01

'''9 * 9'''

for i in range(1, 10):
    for j in range(1, i+1):
      print('%2d*%2d=%2d' % (j, i, i*j), end='   ')
    print('\n')

在具体的怎么调整格式就不会了 看着有点别扭

BISHIQIUQIUI 发表于 2018-5-9 17:07:29

#输出 9*9 乘法口诀表。9行9列
total = ''

for i in range(1, 10):
    for j in range(1, i + 1):
      if i != j:
            total += '%d x %d = %2d    ' % (j, i, i * j)
      else:
            total += '%d x %d = %2d    \n' % (j, i, i * j)
print(total)

892427369 发表于 2018-7-18 16:47:42

for a in range(1,10):
    for b in range(1,10):
      print(b,"*",a,"=",a*b,sep="",end=" ")
    print()

astray123 发表于 2018-7-20 16:54:59

for i in range(1,10):
    for j in range(1,i+1):
      if(i != j):
            print('%d x %d = %2d' % (i,j,i*j),end = '')
      else:
            print('%d x %d = %2d \n' % (i,j,i*j))

DavidCowboy 发表于 2018-8-1 16:12:44

還沒學到幾位大佬用的語句,只會直直的列出來

for i in range(1,10):
    for j in range(1,10):
      print(i , ' * ' , j , ' = ' , i*j)

songmenghua 发表于 2018-8-18 22:16:58

for i in range(1,10):
      for j in range(1, i+1):
                c = i*j
                print('%d*%d=%d'%(i, j, c)),
      print '\n'

一步半个脚印 发表于 2018-8-22 15:07:51

for i in range(1,10):
    for j in range(1,i+1):
      temp=i*j
      print(j,'X',i,"=",temp),
    print("\n")


for i in range(1,10):
    for j in range(1,i+1):
      temp=i*j
      print('%dX%d=%2s'%(j, i, i * j)),
    print("\n")


嘎嘎啊
页: 1 2 [3] 4 5 6
查看完整版本: Python:每日一题 7