Skip to content

Instantly share code, notes, and snippets.

@gceylan
Created May 24, 2011 18:38
Show Gist options
  • Save gceylan/989347 to your computer and use it in GitHub Desktop.
Save gceylan/989347 to your computer and use it in GitHub Desktop.
soru.py
def row_times_column(m1, row, m2, column):
"""
>>> row_times_column([[1, 2], [3, 4]], 0, [[5, 6], [7, 8]], 0)
19
>>> row_times_column([[1, 2], [3, 4]], 0, [[5, 6], [7, 8]], 1)
22
>>> row_times_column([[1, 2], [3, 4]], 1, [[5, 6], [7, 8]], 0)
43
>>> row_times_column([[1, 2], [3, 4]], 1, [[5, 6], [7, 8]], 1)
50
"""
def matrix_mult(m1, m2):
"""
>>> matrix_mult([[1, 2], [3, 4]], [[5, 6], [7, 8]])
[[19, 22], [43, 50]]
>>> matrix_mult([[1, 2, 3], [4, 5, 6]], [[7, 8], [9, 1],
[2, 3]])
[[31, 19], [85, 55]]
>>> matrix_mult([[7, 8], [9, 1], [2, 3]], [[1, 2, 3], [4,
5, 6]])
[[39, 54, 69], [13, 23, 33], [14, 19, 24]]
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment