Question #167305

Write a program to print the right alphabetic triangle up to the given N rows.


Expert's answer

# Python 3 program to print the right alphabetic triangle up to the given N rows
# Prompt user to input number of rows
N = int(input("Enter the number of rows to print N: "))

for i in range(1, N + 1):
    for j in range(i, N + 1):
        print(chr(ord('A') - 1 + j), end=' ')
    print()
LATEST TUTORIALS
APPROVED BY CLIENTS