九九乘法表python的表达方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了九九乘法表python的表达方法相关的知识,希望对你有一定的参考价值。
row = 1
while row <= 9:
col = 1
while col <= row:
print("%d * %d = %d" % (col, row, row*col), end=" ")
col += 1
print("")
row += 1
for row in range(1, 10):
for col in range(1, row+1):
print("{} * {} = {}".format(col, row, row*col), end=" ")
print("")
row = 1
while row <= 9:
col = 1
while col <= row:
print("{} * {} = {}" .format (col, row, row*col), end=" ")
col += 1
print("")
row += 1
for row in range(1, 10):
for col in range(1, row+1):
print("%d * %d = %d"% (col, row, row*col), end=" ")
print("")
以上是关于九九乘法表python的表达方法的主要内容,如果未能解决你的问题,请参考以下文章