乘法表的while2种方法,还有for的没写

以下是代码

#!/usr/bin/env python3
# -*- conding:utf-8 -*-
# @Time: 2017/12/10 19:11
# @Author:Luke
#打印乘法表
i = 1
'''
while i <= 9:
for j in range(9):
j += 1
if j == 9 and i != 9:
print(" ")
elif j > i :
continue
else:
print("%d * %d = %d " % ( i , j ,i * j ),end=" ")
i += 1
'''
#这种方法更简便
while i <= 9:
j = 1
while j <= i :
x = i * j
print("%d * %d = %d "%(j,i,x),end=" ")
j += 1
print("")
i += 1
欢迎探讨问题
原文地址:https://www.cnblogs.com/lzh-luke/p/8017971.html