rows = int(raw_input('输入列数: '))
i = j = k = 1
print "等腰直角三角形1"
for i in range(0, rows):
for k in range(0, rows - i):
print " * ",
k += 1
i += 1
print "\n"
print "打印空心等边三角形,这里去掉if-else条件判断就是实心的"
for i in range(0, rows + 1):
for j in range(0, rows - i):
print " ",
j += 1
for k in range(0, 2 * i - 1):
if k == 0 or k == 2 * i - 2 or i == rows:
if i == rows:
if k % 2 == 0:
print "*",
else:
print " ",
else:
print "*",
else:
print " ",
k += 1
print "\n"
i += 1
print "打印空心等菱形,这里去掉if-else条件判断就是实心的"
for i in range(rows):
for j in range(rows - i):
print " ",
j += 1
for k in range(2 * i - 1):
if k == 0 or k == 2 * i - 2:
print "*",
else:
print " ",
k += 1
print "\n"
i += 1
for i in range(rows):
for j in range(i):
print " ",
j += 1
for k in range(2 * (rows - i) - 1):
if k == 0 or k == 2 * (rows - i) - 2:
print "*",
else:
print " ",
k += 1
print "\n"
i += 1
print "实心正方形"
for i in range(0, rows):
for k in range(0, rows):
print " * ",
k += 1
i += 1
print "\n"
print "空心正方形"
for i in range(0, rows):
for k in range(0, rows):
if i != 0 and i != rows - 1:
if k == 0 or k == rows - 1:
print " * ",
else:
print " ",
else:
print " * ",
k += 1
i += 1
print "\n"