You probably guessed it, but yeah today's section was matrices. Yk 2D arrays basically. It was a familiar section. I took a class in high school that went over this.
Notes!!!!: - If a question asks about a simulation, or something about a path. Think of the change that an object has to do to stay on the path. usually requires modulus and a change of
coordinate number
- Transposing a matrix can be done with zip(*matrix), but its a generator like the others. You should cast it to a list
- Another way of transposing, is switching the values of a matrix or swapping. Keep in mind there is a way in python to not need temp variables when swapping.
python kind of holds the variables and doesn't set them equal until the statement is over
ex. matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
- See how there is no temp variables. Python is pretty dam handy
- Use helper methods when needed, makes the code readible
No comments:
Post a Comment