INNER CODE UNIT · Python

n_cols

webartifex/intro-to-python · 11_classes/sample_package/matrix.py:108

    def n_cols(self):
        """Number of columns in a Matrix."""
        return len(self._entries[0])

    def __len__(self):
        """Number of entries in a Matrix."""
        return self.n_rows * self.n_cols

    def __getitem__(self, index):
        """Obtain an individual entry of a Matrix.

        Args:
            index (int / tuple of int's): if index is an integer,
                the Matrix is viewed as a sequence in row-major order;
                if index is a tuple of integers, the first one refers to
                the row and the second one to the column of the entry

        Returns:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…