1. right triangle
a = int(input(' Please enter the number of print lines :'))
for i in range(1,a+1):
for j in range(i):
print(end='*')
print()
2. an isosceles triangle
a = int(input(' Please enter the number of print lines :'))
for i in range(1,a+1):
for j in range(a+1-i):
print(end=' ')
for k in range(2*i-1):
print(end='*')
print()
3. Inverted triangle
a = int(input(' Please enter the number of print lines :'))
for i in range(a):
for j in range(i):
print(end=' ')
for k in range(2*(a-i)-1):
print(end='*')
print()
4. The diamond
a = int(input(' Please enter the number of print lines :'))
for i in range(1,a//2+1):
for k in range(a//2+1-i):
print(end=' ')
for j in range(2*i-1):
print('*',end='')
print()
for i in range(a//2+1):
for k in range(i):
print(end=' ')
for j in range(a-2*i):
print('*',end='')
print()
5. parallelogram
a = int(input(' Please enter the number of print lines :'))
for i in range(a):
for j in range(a-i):
print(end=' ')
for k in range(a):
print(end='*')
print()
6. Hollow diamond
a = int(input(' Please enter the number of print lines :'))
for i in range(1,a+1):
for j in range(a+1-i):
print(end=' ')
for k in range(2*i-1):
if i == 1 or k == 0 or k== 2*i-2:
print(end='*')
else:
print(end=' ')
print()
for i in range(1,a+1):
for j in range(i):
print(end=' ')
for k in range(2*(a-i)):
if k == 1 or k== 2*(a-i)-1:
print(end='*')
else:
print(end=' ')
print()
7. Cross Diamond
a = int(input(' Please enter the number of print lines :'))
for i in range(1,a+1):
for j in range(a+1-i):
print(end=' ')
for k in range(2*i-1):
if i == 1 or k == 0 or k== 2*i-2 or i ==a or k ==i-1:
print(end='*')
else:
print(end=' ')
print()
for i in range(1,a+1):
for j in range(i):
print(end=' ')
for k in range(2*(a-i)):
if k == 1 or k== 2*(a-i)-1 or k == a-i:
print(end='*')
else:
print(end=' ')
print()