Q. What is the output of the following code?


for i in range (4) :

    for j in range (5) :

        if i + 1 == j or j + i == 4 :

            print ("+", end = ' ')

        else :

            print ("o", end = ' ')

print ()



Answer =

Output: -

o + o o + o o + + o o o + + o o + o o +

6 Comments

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

  1. Could you please explain why is the output as so?

    ReplyDelete
    Replies
    1. At first you have to understand how "for" loop is working then think the program then you will able to write Output.

      Delete
    2. Please give complete Explanation

      Delete
  2. Replies
    1. You are wrong , please copy the above code and see output

      Delete

Post a Comment

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

Previous Post Next Post