{{ message }}
Update matrix_operation.py - #2344
Merged
Merged
Conversation
cclauss
reviewed
Aug 21, 2020
| [31, 32, 33, 34], [41, 42, 43, 44]] | ||
| matrix_d = [[3, 0, 2], [2, 0, -2], [0, 1, 1]] | ||
| multiply([[1, 2, 3]], [[2], [3], [4]]) | ||
| print( |
Member
There was a problem hiding this comment.
In Python >= 3.8, you can use this trailing = syntax...
% python3.8
Python 3.8.5 (default, Jul 21 2020, 10:48:26)
>>> from operator import add
>>> f"{add(2, 3) = }"
'add(2, 3) = 5'
>>>
Member
There was a problem hiding this comment.
print(f"Add Operation: {add(matrix_a, matrix_b) = }")
Author
There was a problem hiding this comment.
Actually I'm still using py3.7... I would fix it.
stokhos
pushed a commit
to stokhos/Python
that referenced
this pull request
Jan 3, 2021
* Update matrix_operation.py * Update matrix_operation.py * Update matrix_operation.py * Update matrix_operation.py * Update matrix_operation.py * Update matrix_operation.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Describe your change:
Use List comprehension to simplify operations, also fix a bug in multiply. Use tuples to improve speed.
Checklist:
Fixes: #{$ISSUE_NO}.