Predict the output of the following code?

for i in range(6):

for j in range (5):

If (i + 1==j or j+i== 4):

print(“+”, end="")

else:

print (“0”, end="")

print()

 

Answer:

Short Question 9 - Teachoo.jpg

Output:

0+00+

00++0

00++0

0+00+

+0000

00000

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo