Write a Python program to print right triangle character pattern using for loop.
rows = int(input("Enter Right Triangle Characters Pattern Rows = ")) print("====The Right Triangle of Characters Pattern====") alphabet = 65 for i in range(1, rows + 1): for j in range(2 * i - 1): print('%c' %(alphabet + j), end = '') print()
This Python example prints the right angled triangle pattern of characters using a while loop.
rows = int(input("Enter Right Triangle Characters Pattern Rows = ")) print("====The Right Triangle of Characters Pattern====") alphabet = 65 i = 1 while(i <= rows): j = 0 while(j <= 2 * i - 2): print('%c' %(alphabet + j), end = '') j = j + 1 print() i = i + 1
Enter Right Triangle Characters Pattern Rows = 14
====The Right Triangle of Characters Pattern====
A
ABC
ABCDE
ABCDEFG
ABCDEFGHI
ABCDEFGHIJK
ABCDEFGHIJKLM
ABCDEFGHIJKLMNO
ABCDEFGHIJKLMNOPQ
ABCDEFGHIJKLMNOPQRS
ABCDEFGHIJKLMNOPQRSTU
ABCDEFGHIJKLMNOPQRSTUVW
ABCDEFGHIJKLMNOPQRSTUVWXY
ABCDEFGHIJKLMNOPQRSTUVWXYZ[