Computer Science, asked by Fsg9, 10 months ago

WAP to print the following pattern
(PYTHON)


A
BB
CCC
DDDD
EEEEEE

Answers

Answered by bhuwanpaneru
29

Explanation:

val = 65

for i in range(0, 5):

for j in range(0, i+1):

ch = chr(val)

print(ch, end=" ")

val = val + 1

print()

Answered by AskewTronics
5

Below are the program in python for the above question

Explanation:

size=int(input("Enter the size of the series"))  # takes the input from the user

i=1

c = ord('A') # initialize the first character

while(i<=size):  # first loop

   j=1

   while(j<=i):  # second loop

       print(chr(c), end=(''))  

       j=j+1

   i=i+1

   c=c+1

   print("") #it is used to line change.

Output:

  • when the user gives input as 1, then it will print the one line series.
  • When the user gives input as 5, then it will print the series which is given in the question.

Code Explanation:

  • The above program takes the input size of the series and prints the series up to that size.
  • If anyone wants that the series can start with the other letter, then it will print only when he writes that letter on the place of A.
  • The first loop is used for the size and the second loop is used to print every line of the series.

Learn more:

  • Python program: https://brainly.in/question/5558161
Similar questions