This is what I currently have:
[[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
This is what my expected outcome looks like:
[[1,3],[5,7],[9,11],[13,15]]
This is what I currently have:
[[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
This is what my expected outcome looks like:
[[1,3],[5,7],[9,11],[13,15]]
You can use unpacking:
s = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
new_data = [[a, b] for a, _, b, c in s]
Output:
[[1, 3], [5, 7], [9, 11], [13, 15]]
t = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
x = []
for v in t:
x.append([v[0], v[2]])