I have a list of lists and I want to print the first 2 elements of the first 2 sub-lists.
I don't know if I am approaching it in the wrong way but I don't get the desired output.
Here is my code:
x = [[1, 2, 3, 4, 5, 6],
['a', 'b', 'c'],
[1.1, 2.2, 3.3]]
print(x[0:2])
print(x[0:2][0:2])
output:
[[1, 2, 3, 4, 5, 6], ['a', 'b', 'c']]
[[1, 2, 3, 4, 5, 6], ['a', 'b', 'c']]
expected output:
[[1, 2, 3, 4, 5, 6], ['a', 'b', 'c']]
[[1, 2], ['a', 'b']]