0

Can someone please give me a detailed explanation for this code? I copied it from a textbook, but can't understand how it works

https://code.sololearn.com/c94tUQYa71OU/?ref=app

21st Jul 2018, 5:21 AM
Parth Salat
Parth Salat - avatar
9 Réponses
+ 1
then put prints in every loop so you can follow the programm and see what happens
21st Jul 2018, 1:33 PM
darkorbit17493
+ 1
The point is that the loops are going to increase the variable count and whenever i is equal to 3 ,j is equal to 4 and k is equal to 5 the first loop stops and with it all other loops stop and the program outputs count
21st Jul 2018, 1:22 PM
darkorbit17493
+ 1
np
21st Jul 2018, 2:49 PM
darkorbit17493
0
if you put intervals on the both sides of all && operators things are gonna be much more clear.And if you still cant understand the code you need to learn loops
21st Jul 2018, 1:16 PM
darkorbit17493
0
Thanks darkorbit17493 for the tip, but I can't understand whether that && Line is being executed or not?also if the inner loops work first or the outer
21st Jul 2018, 1:21 PM
Parth Salat
Parth Salat - avatar
0
The main problem is that 'k' doesn't stop at 3 it goes on to become 4
21st Jul 2018, 1:28 PM
Parth Salat
Parth Salat - avatar
0
Sounds good 👍
21st Jul 2018, 1:34 PM
Parth Salat
Parth Salat - avatar
0
oh and what do you mean by k doesnt stop at 3 it have to stop only when i=1 and j=2
21st Jul 2018, 1:59 PM
darkorbit17493
0
Thanks a lot darkorbit17493, your idea of printing at each step helped me analyze it clearly
21st Jul 2018, 2:49 PM
Parth Salat
Parth Salat - avatar