+ 1

Please give the output of the following with explanation!

for i in range(4) for j in range (5) if i+1==j or j+1==4: print("+",end=' ') else: print ("0",end=' ') print()

14th Mar 2019, 6:04 AM
Nityananda Padhi
Nityananda Padhi - avatar
2 Réponses
+ 6
You're getting errors because you didn't put colons at the end of your 'for' lines. Also you're getting an IndentationError because you put a space in front of the last print() function. Fix those and your code works fine. 🙂 https://code.sololearn.com/cq0GQWYFDTeU
14th Mar 2019, 7:08 AM
David Ashton
David Ashton - avatar
+ 2
Add colons ‘:’ at the end of your 1st & 2nd line. Remove last line. https://code.sololearn.com/cYT0hr29iDK4/?ref=app
17th Mar 2019, 6:32 AM
Mohive Parvez
Mohive Parvez - avatar