Use list comprehension to generate the list of all perfect numbers less than 10,000, .
What is their sum ?
Assumptions and Details
Suppose you're working on code for a molecular dynamics visualization. You need to represent various matrices, like the 3d rotation matrix, using Python lists. We can do so by using lists of lists.
For example, the matrix
is represented by
and the matrix
The fragments below are designed to perform operations on matrices. Your task is to match the function bodies with the correct function definitions.
1 2 3
1 2 3
The function bodies are given by the following
In scientific computing, it is a common task to take the transpose of a matrix. The transpose of a matrix , , is found by turning all the rows of a matrix into columns and vice versa. More formally the transpose of a matrix is found by reflecting over its main diagonal.
For example, the transpose of
is given by
Which of the following snippets of code would correctly transpose the matrix ?