We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 358d9dd commit 544774cCopy full SHA for 544774c
hollow_diamond_alphabets.py
@@ -1,10 +1,10 @@
1
def hollow_diamond_alphabet(n):
2
'''
3
Prints a hollow diamond pattern using alphabet characters.
4
-
+
5
Parameters:
6
n (int): The size of the diamond. Determines the number of rows.
7
8
Example:
9
>>> hollow_diamond_alphabet(5)
10
A
@@ -17,7 +17,7 @@ def hollow_diamond_alphabet(n):
17
B C
18
A '''
19
20
21
22
23
alpha=64
@@ -29,16 +29,16 @@ def hollow_diamond_alphabet(n):
29
else:
30
print(left_spaces+chr(alpha)+hollow_spaces+chr(alpha+1))
31
alpha+=2
32
- alpha-=2
+ alpha-=2
33
for i in range(n-1,0,-1):
34
left_spaces=" "*(n-i)
35
hollow_spaces=" "*(((i-1)*2)-1)
36
if(i==1):
37
print(left_spaces+chr(alpha-1))
38
39
print(left_spaces+chr(alpha-2)+hollow_spaces+chr(alpha-1))
40
41
42
43
44
n=int(input())
0 commit comments