(May-18-2018, 08:17 AM)buran Wrote:print([[i,j,k] for i in range(x+1) for j in range(y+1) for k in range(z+1) if i+j+k != n])
Being an extremely lazy person , I would have written that as
[coords for coords in itertools.product(range(x+1), range(y+1), range(z+1)) if sum(coords) != n]I know that it is actually longer - but I really hate one-letter variables (
x
, y
and z
I can forgive )
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.