<problem>
Write a function `determinant(matrix:List[List [int]]) -> List[List[int]]` that calculates the determinant of a 3x3 matrix.
## Example Cases:
```
determinant([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) => 0
determinant([[4, -7, 9], [6, 0, 3], [-1, 7, 0]]) => 315
determinant([[-6, 0, 5], [-8, -8, -5], [-10, 2, 8]]) => -156
determinant([[2, -1, -8], [5,-1,-3], [-1,-9, 6]]) => 329
```
</problem>
<bug_code>
1. def det2d(matrix):
2.    return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]
3.
4. def determinant(matrix):
5.
6.    subm1 = [val[1:3] for val in matrix[1:3]]
7.    subm2 = [matrix[1][0], matrix[1][2], matrix[2][0], matrix[2][2]]
8.    subm3 = [matrix[1][0], matrix[1][1]], [matrix[2][0], matrix[2][1]]
9.
10.    return matrix[0][0] * det2d(subm1) - matrix[0][1] * det2d(subm2) + matrix[0][2] * det2d(subm3)
</bug_code>
<bug_desc>
On line 7, `subm2` is created as a one dimensional array. However, when line 10 evaluates `det2d(subm2)`, it assumes that it is a two dimensional array, which raises a TypeError exception.
</bug_desc>
<bug_fixes>
Change line 7 to `subm2 = [[matrix[1][0], matrix[1][2]], [matrix[2][0], matrix[2][2]]]` and change line 8 with `subm3 = [[matrix[1][0], matrix[1][1]], [matrix[2][0], matrix[2][1]]]`.
</bug_fixes>
<unit_tests>
assert determinant([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == 0
assert determinant([[4, -7, 9], [6, 0, 3], [-1, 7, 0]]) == 315
assert determinant([[-6, 0, 5], [-8, -8, -5], [-10, 2, 8]]) == -156
assert determinant([[2, -1, -8], [5, -1, -3], [-1, -9, 6]]) == 329
</unit_tests>
<stu_desc>

</stu_desc>
<dialogue>
User: I'm trying to write a function to calculate the determinant of a 3x3 matrix, and it's not going well. I want to calculate the determinant using the three 2x2 submatrices.
	<alt>I'm trying to write a function to calculate the determinant of a 3x3 matrix using submatrices, but I'm getting a strange TypeError in my helper function.
Assistant: I know we can fix this together. What are the issues you're having?
	<alt>Can you describe your code of the method `determinant` line by line to me?
	<alt>Can you explain how you're creating the 2x2 submatrices?
User: Well, at first I was getting the wrong answer and now I'm getting TypeErrors. It says "'int' object is not subscriptable" when I'm calling the `det2d` function.
Assistant: What are the intended inputs and outputs of the `det2d` function?
	<alt>What are the intended inputs and outputs of the `det2d` function? You may be passing in an `int` when you intend to pass a `list`.
	<alt>Can you describe the `det2d` function to me?
	<alt>What does the error message `"'int' object is not subscriptable"` mean?
	<alt>How do you know that the error is coming from the `det2d` function?
	<alt>Which variables are getting subscripted and how do you know what the data type of those variables are?
	<alt>Let's open the Python interpreter and try running `[1, 2, 3][0][0]`. What happens?
User: I'm trying to pass in the submatrix, so an array of arrays. Right now I'm passing in `[matrix[1][0], matrix[1][2], matrix[2][0], matrix[2][2]]`. Oh, I see, I'm missing a set of brackets! This is just a 1D array right now.
Assistant: Great! Did you make the same mistake anywhere else?
	<alt>Great! Does that also apply for `subm3` or is that calculated correctly?
	<alt>What about the other two submatrices?
User: I think I made a similar mistake with `subm3`. I'll change both. It works!
<code>
 def det2d(matrix):
    return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]
def determinant(matrix):
    subm1 = [val[1:3] for val in matrix[1:3]]
    subm2 = [[matrix[1][0], matrix[1][2]], [matrix[2][0], matrix[2][2]]]
    subm3 = [[matrix[1][0], matrix[1][1]], [matrix[2][0], matrix[2][1]]]
    return matrix[0][0] * det2d(subm1) - matrix[0][1] * det2d(subm2) + matrix[0][2] * det2d(subm3)

</code>
</dialogue>