You are viewing a single comment's thread. Return to all comments →
It is in lexographical order due to the nature of the loops.
Spaced out it looks somewhat like
for a in range(x+1):
for b in range(y+1):
for c in range(z+1):
if a + b + c != n:
print(stuff is here)
We start at [0,0,0].
Then c will increment to get to [0,0,1]
When c hits [0,0,z], we get [0,1,0] as the next in the loop. This pattern continues and gives us the lexographical ordering required of the output.
it's very helpfull to understanding that what is actualy asking
Thank you. This is the a verbose response, but clearly the most elegant to understand what's going on.
yup! i understand.
Thanks for your solution, now we understand how it's word.
Here is my soltion with your sussgestion:
empty_list = 
for a in range ( x+ 1):
for b in range ( y + 1):
for c in range ( z + 1):
if (a + b + c != n) :
But my program is not working properly.
Thank you, I really wondered on how it works.
really much helpfull in understanding