标签:乘法 bar end def n+1 递归 \n code int
写代码完成99乘法表
# 1 * 1 = 1
# 2 * 1 = 2 2 * 2 = 4
# 3 * 1 = 3 3 * 2 = 6 3 * 3 = 9
# ......
# 9 * 1 = 9 9 * 2 = 18 9 * 3 = 27 9 * 4 = 36 9 * 5 = 45 9 * 6 = 54 9 * 7 = 63 9 * 8 = 72 9 * 9 = 81
def bar(n):
for i in range(1,n+1):
res = "{} * {} = {}".format(n, i, n * i)
print(res,end=" ")
if n < 9:
n += 1
print("\n")
bar(n)
bar(1)
标签:乘法 bar end def n+1 递归 \n code int
原文地址:https://www.cnblogs.com/xiayuhao/p/9520335.html