输出各种形状三角形:
#coding=UTF-8
rows =int(input('输入列数: '))
print"用for函数书写的正等腰直角三角形"
for i in range(0, rows):
for k in range(0, i+1):
print" * ",
print"\n"
print"用for函数书写的倒等腰直角三角形"
for i in range(0, rows):
for k in range(0, rows-i):
print" * ",
print"\n"
print"用while函数书写的正等腰直角三角形"
i=1
while i:
j=1
while j:
print"*"," ",
if i==j:
break
j+=1
if j>rows:
break
print"\n"
i+=1
if i>rows:
break