1 #_*_coding:UTF-8_*_ 2 rows = int(raw_input('输入列数:')) 3 i = j = k = 1 4 print "等腰" 5 for i in range(0,rows): 6 for k in range(0,rows-i): 7 print"*", 8 k +=1 9 i +=1 10 print " " 11 print "打印空心等边三角形" 12 for i in range(0,rows+1): 13 for j in range(0,rows-i): 14 print" ", 15 j +=1 16 for k in range(0,2*i-1): 17 if k == 0 or k == 2*i-2 or i == rows: 18 if i == rows: 19 if k % 2 == 0: 20 print "*", 21 else: 22 print " ", 23 else: 24 print "*", 25 else: 26 print " ", 27 k += 1 28 print" " 29 i += 1