Write a Python program to print right arrow alphabets pattern using for loop.
rows = int(input("Enter Right Arrow Alphabets Pattern Rows = ")) print("====The Right Arrow Alphabets Pattern====") alphabet = 65 for i in range(rows): for j in range(i): print(end = ' ') for k in range(i, rows): print('%c' %(alphabet + k), end = '') print() for i in range(rows - 2, -1, -1): for j in range(i): print(end = ' ') for k in range(i, rows): print('%c' %(alphabet + k), end = '') print()
This Python example prints the right arrow pattern of alphabets using a while loop.
rows = int(input("Enter Right Arrow Alphabets Pattern Rows = ")) print("====The Right Arrow Alphabets Pattern====") alphabet = 65 i = 0 while(i < rows): j = 0 while(j < i): print(end = ' ') j = j + 1 k = i while(k < rows): print('%c' %(alphabet + k), end = '') k = k + 1 print() i = i + 1 i = rows - 2 while(i >= 0): j = 0 while(j < i): print(end = ' ') j = j + 1 k = i while(k < rows): print('%c' %(alphabet + k), end = '') k = k + 1 print() i = i - 1
Enter Right Arrow Alphabets Pattern Rows = 12
====The Right Arrow Alphabets Pattern====
ABCDEFGHIJKL
BCDEFGHIJKL
CDEFGHIJKL
DEFGHIJKL
EFGHIJKL
FGHIJKL
GHIJKL
HIJKL
IJKL
JKL
KL
L
KL
JKL
IJKL
HIJKL
GHIJKL
FGHIJKL
EFGHIJKL
DEFGHIJKL
CDEFGHIJKL
BCDEFGHIJKL
ABCDEFGHIJKL