Trying to print possible number combinations in single line as list but the list have wrong output. My output is like this:
[[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]]
When it should be like this:
[0, 0, 0]
[0, 0, 1]
[0, 1, 0]
[0, 1, 1]
[1, 0, 0]
[1, 0, 1]
[1, 1, 0]
[1, 1, 1]
My code is
if __name__ == '__main__':
x = 1
y = 1
z = 1
kordinat = ["x","y","z"]
result = []
for xx in range(x+1):
kordinat[0] = xx
for yy in range(y+1):
kordinat[1] = yy
for zz in range(z+1):
kordinat[2]= zz
print(kordinat)
result.append(kordinat)
print(result)