Q. Write a program that uses exactly four for loops to print the sequence of letters below.


AAAAAAAAAABBBBBBBCCCCCCEEEEE

 

Answer =

 

for i in range (1, 5) :
    print ("A" * i , end = "")
for i in range (3, 5) :
    print ("B" * i , end = "")
for i in range (1, 4) :
    print ("C" * i , end = "")
for i in range (2, 4) :
    print ("E" * i , end = "")

 

3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. could u tell me the answer
    for this question
    'Write a program that uses a for loop to print the numbers 100, 98, 96, . . . , 4, 2.'

    ReplyDelete
    Replies
    1. for i in range (100, 1,-2) :
      print( i , end = " , ")

      Delete
  2. 2. Write a program to fill the screen horizontally and vertically with your name. [Hint: add the option end='' into the print function to fill the screen horizontally.]

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post