九九乘法表

num2 = 1
num1 = 1
while num2 <= 9:
num = 1
while num <= num1:
print(num,end="X")
print(num1,end="=")
sum = num * num1
print(sum,end=" ")
num = num + 1
num1 = num1 + 1
print("")
num2 = num2 + 1



简化版

first = 1
while first <= 9:
second = 1
while second <= first:
print(str(second)+"X"+str(first)+"="+str(second*first),end=" ")
second += 1
print("")
first += 1
posted @ 2018-05-22 10:29  不解释丨Python  阅读(286)  评论(0编辑  收藏  举报