方法一:
while循环求
a = 1
while a <= 9:
b = 1
while b <= a:
print(a, "*", b, "=", a*b," ",end = '')
b += 1
print("\n")
a += 1
输出为
方法二:
for循环求
for i in range(1, 10):
for j in range(1, i+1):
print('{} x {} = {} '.format(j, i, i*j), end='')
print()
输出为