# 乘法表 def multiplication(y): counter = 0 while counter < y: # 外循环,换行,逐一增加加号后面数字 x = 1 counter += 1 print("|", end="") while x <= counter: # 内循环,输出当前行, print("%2d" % x, "*", "%2d" % counter, "=", "%3d" % (x * counter), end=" |") x += 1 print(end="\n") multiplication(15)
初级程序员
by: Tanghcai 发表于:2021-10-22 23:20:43 顶(1) | 踩(1) 回复
希望对大家有用
回复评论