Corrected filename and include static types#2440
Corrected filename and include static types#2440cclauss merged 4 commits intoTheAlgorithms:masterfrom
Conversation
- The name of the file is now compliant with python naming conventions - Add static type as stated in contributing guidelines
|
Hi @NumberPiOso , Also I see that you included type hints for some variables too. Like: user_input: str = input("Enter numbers separated by comma:\n").strip()
sequence: List[int] = [int(item.strip()) for item in user_input.split(",")]etc. I think CONTRIBUTING.md says to provide type hints only for the input parameters and return values of functions and nothing else, because it causes too much visual clutter and Python is smart enough to figure it out. (There might be some exceptions to this but I don't know.) Good luck and happy coding! |
| >>> print(binary_search(test_list, 3)) | ||
| False | ||
| >>> print(binary_search(test_list, 13)) | ||
| True |
There was a problem hiding this comment.
Please add tests for negative integers, floats, repeated numbers, letters, empty list, single element list.
|
Hi @spamegg1
It is because the other file was named simple-binary-search.py so I renamed it to simple_binary_search.py I did it using git mv, is there any other way to do this in order for github to show us the differences?
Totally agreed, I will correct it. Thank you. |
- Delete documentation line to run doctests - Delete type hints for variables that comes from functions Co-authored-by: Christian Clauss <cclauss@me.com>
cclauss
left a comment
There was a problem hiding this comment.
LGTM. It would be easier to review as two PRs. One that changed the filename and the other that changed the file contents.
* Corrected name and include static types
- The name of the file is now compliant with python naming conventions
- Add static type as stated in contributing guidelines
* Apply suggestions from code review
- Delete documentation line to run doctests
- Delete type hints for variables that comes from functions
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add edge cases tests.
* print(f"{target} was {not_str}found in {sequence}")
Co-authored-by: Christian Clauss <cclauss@me.com>
continuing in line with #2128.
My first time contributing code to open source so criticism is encouraged.
Describe your change:
Checklist: