Skip to content

Commit 3a6126a

Browse files
authored
Create alphabeticpattern21.py
1 parent 093ee18 commit 3a6126a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
def pattern(n):
2+
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3+
counter = 0
4+
for i in range(0,n+1):
5+
for j in range(0,i):
6+
if(counter>25):
7+
counter = counter - 26
8+
print(alpha[counter],end=" ")
9+
counter=counter+1
10+
print("")
11+
12+
print("Enter the number of rows: ")
13+
n = int(input())
14+
pattern(n)
15+
16+
17+
# OUTPUT
18+
19+
# Enter the number of rows:
20+
# 5
21+
22+
# A
23+
# B C
24+
# D E F
25+
# G H I J
26+
# K L M N O

0 commit comments

Comments
 (0)