# coding: utf-8
print("—————————— 嵌套循环 ——————————")
'''
while 表达式1:while 表达式2:语句块2for 循环变量1 in 遍历对象1:for 循环变量2 in 遍历对象2:语句块2
'''print("———————————— 长方形 ——————————————")
for i in range(1,4): # 3行for j in range(1,5):print("*", end='')print()n = eval(input("请输入n:"))
m = eval(input("请输入m:"))
for i in range(1,n+1): # n行for j in range(1,m+1): # m列print("*", end='')print()print("———————————— 正三角形 ——————————————")
for i in range(1,6): # 5行for j in range(1,i+1):print("*",end='')print()a = eval(input("请输入a:"))
for i in range(1,a+1): # a行for j in range(1,i+1):print("*",end='')print()print("———————————— 倒三角形 ——————————————")
for i in range(1,6): # 5行for j in range(1,6-i):print("*",end='')print()print("—————————————— 等腰三角形 ————————————")
for i in range(1,6):for j in range(1,6-i):print(" ",end='')for k in range(1,i*2):print("*",end='')print()print("—————————————— 菱形 ——————————————")
row1 = eval(input("上行数:"))
row2 = eval(input("下行数:"))
# 上部分
for i in range(1,row1+1):for j in range(1,row1+1-i):print(" ",end='')for k in range(1,i*2):print("*",end='')print()# 下部分
for a in range(1,row2+1):for b in range(1,a):print(" ",end='')for c in range(1,2*row2-2*a+2):print("*",end='')print()print("—————————————— 空心菱形 ——————————————")
row3 = eval(input("上行数:"))
row4 = eval(input("下行数:"))
# 上部分
for i in range(1,row3+1):for j in range(1,row3+1-i):print(" ",end='')for k in range(1,i*2):if k == 1 or k == i*2-1:print("*",end='')else:print(" ",end='')print()# 下部分
for a in range(1,row4+1):for b in range(1,a):print(" ",end='')for c in range(1,2*row4-2*a+2):if c == 1 or c == 2*row4-2*a+1:print("*",end='')else:print(" ",end='')print()