I have a tuple of rows and columns and wanted to access the last row and last column from it.
how to do this?
I have a tuple of rows and columns and wanted to access the last row and last column from it.
how to do this?
If you have one dimensional tuple, let's say t
, you can do t[-1]
to get the last element.
Or if your tuple has 2 dimensions, you can use t[-1][-1]
to get the last row and last column. For example:
>>> my_tuple = [[1, 2, 3], [4, 5, 6]]
>>> my_tuple[-1][-1]
6