3. Write a Python program to get the following output
A
A B
A B C
A B C D
Answers
Answered by
0
Langauge:
Python
Program:
n=int(input())
for i in range(1,n+1):
for j in range(0,i):
print(chr (65+j),end=" ")
print()
I/O:
[In]: 4
[Out]:
A
A B
A B C
A B C D
Explanation:
- Take input for number of rows.
- Use chr (n) where n is an integer (+ve) to get relative ASCII symbol.
- Use nested loops to mamipulate positions of letters
Attachment:
Attachments:
Similar questions