-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Update matrix_operation.py #2159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey @wuyudi, TravisCI finished with status TravisBuddy Request Identifier: 0371ccf0-bc1b-11ea-937a-75d40a178b7c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please go through the logs and make sure that the flake8 style guidelines are followed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use yapf psf/black to format the code
Travis tests have failedHey @wuyudi, TravisBuddy Request Identifier: ca56e850-bc20-11ea-937a-75d40a178b7c |
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Hey @wuyudi, TravisCI finished with status TravisBuddy Request Identifier: 4796c750-bc2f-11ea-937a-75d40a178b7c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add float doctest
matrix/searching_in_sorted_matrix.py
Outdated
[[2, 5, 7], [4, 8, 13], [9, 11, 15], [12, 17, 20]], 3, 3, 21) | ||
Key 21 not found | ||
''' | ||
def search_in_a_sorted_matrix(mat, m, n, key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wuyudi use static typing !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
So I undo it, and would make another pr after this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already done it in this. https://github.com/wuyudi/Python/pull/1/commits/18bedf489048146ef37039fcb6f5e473e8bd36b2
matrix/searching_in_sorted_matrix.py
Outdated
i, j = m - 1, 0 | ||
while i >= 0 and j < n: | ||
if key == mat[i][j]: | ||
print(f"Key {key} found at row- {i + 1} column- {j + 1}") | ||
print("Key {} found at row- {} column- {}".format(key, i + 1, j + 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f string is better than format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the f-string approach as discussed in CONTRIBUTING.md.
Hey @wuyudi, TravisCI finished with status TravisBuddy Request Identifier: 0f38c940-bc65-11ea-937a-75d40a178b7c |
Hey @wuyudi, TravisCI finished with status TravisBuddy Request Identifier: 4b25f900-bc65-11ea-937a-75d40a178b7c |
Co-authored-by: Christian Clauss <cclauss@me.com>
@itsvinayak Please review |
* Update matrix_operation.py * Update matrix_operation.py * Update matrix_operation.py * use yapf to format the code * recover the error check * add typing hint * Update matrix/matrix_operation.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update matrix/matrix_operation.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update matrix/matrix_operation.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update matrix/matrix_operation.py Co-authored-by: Christian Clauss <cclauss@me.com> * add float doctest * black formated * Update searching_in_sorted_matrix.py * recover this file * f-string, typing hint , doctest * Update matrix_operation.py * Update searching_in_sorted_matrix.py * Update matrix_operation.py * Update matrix/matrix_operation.py Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: vinayak <itssvinayak@gmail.com>
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.