London | 25-SDC-Nov | Zohreh Kazemianpour | Sprint 4 | Implement Shell Tools-Python#261
Open
zohrehKazemianpour wants to merge 10 commits intoCodeYourFuture:mainfrom
Open
London | 25-SDC-Nov | Zohreh Kazemianpour | Sprint 4 | Implement Shell Tools-Python#261zohrehKazemianpour wants to merge 10 commits intoCodeYourFuture:mainfrom
zohrehKazemianpour wants to merge 10 commits intoCodeYourFuture:mainfrom
Conversation
LonMcGregor
reviewed
Jan 21, 2026
LonMcGregor
left a comment
There was a problem hiding this comment.
Good start on this sprint's tasks, I have spotted a few areas where you could improve code further
| numbered_line = f"{line_number:6}\t{line}" | ||
| numbered_lines.append(numbered_line) | ||
|
|
||
| print("\n".join(numbered_lines)) # LEVEL 3: inside if |
There was a problem hiding this comment.
Here you are doing the same thing in both if conditions, setting up a list of lines and then printing. Could you reduce some of the code duplication?
| files = [f for f in files if not f.startswith('.')] | ||
|
|
||
| for file in files: | ||
| print(file) No newline at end of file |
There was a problem hiding this comment.
Did you test this program without the -1 option?
| total_words += words | ||
| total_chars += chars | ||
|
|
||
| if args.lines: |
There was a problem hiding this comment.
Did you test with multiple arguments given at once?
| elif args.chars: | ||
| print(f"{total_chars:8} total") | ||
| else: | ||
| print(f"{total_lines:8}{total_words:8}{total_chars:8} total") |
There was a problem hiding this comment.
Do you see the repetition in the structure of the code here? Could that be reduced somehow?
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.
Self checklist
This PR contain implementing Shell tools cat, ls, and wc commands in Python.
This was my first time working with Python! The syntax felt familiar coming from JavaScript, though I had to get used to indentation being required and some differences like
len()vs.length.