KnowledgeBoat Logo

Computer Science

Write programs using nested loops to produce the following patterns:

A
A B
A B C
A B C D
A B C D E
A B C D E F

Python

Python Control Flow

112 Likes

Answer

n = 6

for i in range(n) :
    t = 65
    for j in range(i + 1) :
        print(chr(t), end = ' ')
        t += 1
    print()

Output

A 
A B 
A B C
A B C D
A B C D E
A B C D E F

Answered By

37 Likes


Related Questions