# -*- coding: utf-8 -*-
# Author :Gogh
# @Time :2017/11/16 20:40
# @Email :[email protected]
#第一种方法
for i in range(1, 10):
for j in range(1, 10):
print(j,"*", i,"=",i*j,"\t",end="")
if i == j:
print("")
break
a = [1,2,3]
a.__iter__()
# -*- coding: utf-8 -*-
# Author :Gogh
# @Time :2017/10/31 21:37
# @Email :[email protected]
# 九九乘法表第二种方法
first = 1
while first <= 9:
sec = 1
while sec <= first:
print(str(sec)+"*"+str(first)+"="+str(sec * first), end="\t")
sec += 1
print()
first += 1
# 将九九乘法表倒过来
first1 = 9
while first1 > 0:
sec1 = 1
while sec1 <= first1:
print(str(sec1)+"*"+str(first1)+"="+str(sec1 * first1), end="\t")
sec1 += 1
print()
first1 -= 1
# -*- coding: utf-8 -*-
# Author :Gogh
# @Time :2017/10/31 21:37
# @Email :[email protected]
# 输出一个直角三解形,用户指定输出行数, 可以考虑把三角形倒过来
line = 1
while line <=5:
lin1 = line
while lin1 > 0:
print("*", end="")
lin1 -= 1
print()
line += 1
# 将直角三角形倒过来
line2 = 5
while line2 > 0:
line3 = line2
while line3 > 0:
print("*", end="")
line3 -= 1
print()
line2 -= 1