Skip to content

Commit 544774c

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 358d9dd commit 544774c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hollow_diamond_alphabets.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
def hollow_diamond_alphabet(n):
22
'''
33
Prints a hollow diamond pattern using alphabet characters.
4-
4+
55
Parameters:
66
n (int): The size of the diamond. Determines the number of rows.
7-
7+
88
Example:
99
>>> hollow_diamond_alphabet(5)
1010
A
@@ -17,7 +17,7 @@ def hollow_diamond_alphabet(n):
1717
B C
1818
A '''
1919

20-
20+
2121

2222

2323
alpha=64
@@ -29,16 +29,16 @@ def hollow_diamond_alphabet(n):
2929
else:
3030
print(left_spaces+chr(alpha)+hollow_spaces+chr(alpha+1))
3131
alpha+=2
32-
alpha-=2
32+
alpha-=2
3333
for i in range(n-1,0,-1):
3434
left_spaces=" "*(n-i)
3535
hollow_spaces=" "*(((i-1)*2)-1)
3636
if(i==1):
3737
print(left_spaces+chr(alpha-1))
3838
else:
3939
print(left_spaces+chr(alpha-2)+hollow_spaces+chr(alpha-1))
40-
alpha-=2
41-
40+
alpha-=2
41+
4242

4343

4444
n=int(input())

0 commit comments

Comments
 (0)