Skip to content

Commit 67026d4

Browse files
authored
Create alphabeticpattern23.py
1 parent 3a6126a commit 67026d4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
def pypart2(n):
2+
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3+
k = 2*n - 2
4+
counter = 0
5+
for i in range(0, n):
6+
for j in range(0, k):
7+
print(end=" ")
8+
k = k - 2
9+
10+
for j in range(0, i+1):
11+
print(alpha[counter], end=" ")
12+
counter=counter+1
13+
print("\r")
14+
15+
16+
print("Enter the number of rows: ")
17+
n = int(input())
18+
pypart2(n)
19+
20+
21+
22+
# OUTPUT
23+
24+
# Enter the number of rows:
25+
# 5
26+
# A
27+
# B B
28+
# C C C
29+
# D D D D
30+
# E E E E E

0 commit comments

Comments
 (0)