Skip to content

Instantly share code, notes, and snippets.

@ianfun
Created January 4, 2023 08:42
Show Gist options
  • Save ianfun/46143230d2b4b6dea45e9cdb4294ce62 to your computer and use it in GitHub Desktop.
Save ianfun/46143230d2b4b6dea45e9cdb4294ce62 to your computer and use it in GitHub Desktop.
Simple determinant calculator in python
def clac(l):
return (
l[0][0] * l[1][1] * l[2][2] +
l[0][1] * l[1][2] * l[2][0] +
l[0][2] * l[1][0] * l[2][1]) - (
l[2][0] * l[1][1] * l[0][2] +
l[1][0] * l[0][1] * l[2][2] +
l[0][0] * l[2][1] * l[1][2] )
print(clac(
[
[12,9,7],
[12,10,8],
[12,28,34]
]
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment