简单的for循环打印三角形
1,for循环方法实现星星三角
代码:
for i in range(0,5):
for j in range(i+1):
if i == 4:
print("* ",end="")
continue
if j == 0 or j == i:
print("* ",end="")
else:
print(" ",end="")
print()
2.实心三角:
for i in range(5):
print("* " * (i+1))
3.实心正方形
for i in range(5):
print("* "*5)
print()
4.空心正方形
for i in range(5):
print("* "*5)
print()
for i in range(4):
if i == 0:
print("* " * 5)
if i &#