Jan-10-2018, 05:52 PM
I have just started to learn Python and am going through tutorial. I have the following iteration:
[(x,y,z) for x in [1, 2, 3] for y in [1, 2, 3] for z in [1, 2, 3] if x != y & x != z & y != z]
The answer I get is:
[(1, 2, 3), (2, 1, 3), (3, 1, 2), (3, 2, 1)]
I was wondering why I should not get (2, 3, 1) and (1, 3, 2) as part of my answer.
Thanks,
[(x,y,z) for x in [1, 2, 3] for y in [1, 2, 3] for z in [1, 2, 3] if x != y & x != z & y != z]
The answer I get is:
[(1, 2, 3), (2, 1, 3), (3, 1, 2), (3, 2, 1)]
I was wondering why I should not get (2, 3, 1) and (1, 3, 2) as part of my answer.
Thanks,