I'm trying to print the element with the index of every element in the list
But my implement prints every element with index 0 and every element with index 1 until the last index
can anyone fix it, I'm stuck here?
if __name__=="__main__":
r = [6, 5, 3, 3]
diff = [[(i,j)for i in r]for j in range(5)]
print(diff)
Actual output:
[[(6, 0), (5, 0), (3, 0), (3, 0)], [(6, 1), (5, 1), (3, 1), (3, 1)], [(6, 2), (5, 2), (3, 2), (3, 2)], [(6, 3), (5, 3), (3, 3), (3, 3)], [(6, 4), (5, 4), (3, 4), (3, 4)]]
Desired output:
[(6, 0),(5, 1),(3, 2),(3, 3)]