Given the number of rows N, write a program to print the hallow diamond pattern with alphabets
rows = int(input('Please enter number of rows:'))
space = rows
for i in range(1, rows + 1):
ch = 'A'
for j in range(1, space):
print(end=' ')
space -= 1
for j in range(1, 2 * i):
print(ch, end='')
ch = chr(ord(ch) + 1)
print()
space = 1
for i in range(1, rows):
ch = 'A'
for j in range(1, space + 1):
print(end=' ')
space += 1
for j in range(1, 2 * (rows - i)):
print(ch, end='')
ch = chr(ord(ch) + 1)
print()
Comments
Leave a comment