Open
Conversation
dwz92
approved these changes
May 16, 2024
Comment on lines
+188
to
+198
| "for file_path in all_paths:\n", | ||
| " with open(file_path, 'r') as f:\n", | ||
| " # Read the contents of the file into 'contents'\n", | ||
| " contents = f.readlines()\n", | ||
| " # Display the contents of the first file\n", | ||
| " print(f\"Contents of {file_path}:\")\n", | ||
| " for line in contents:\n", | ||
| " print(line.strip()) # Strip removes leading/trailing whitespace and newline characters\n", | ||
| " # Break out of the loop after displaying the contents of the first file\n", | ||
| " break\n", | ||
| "\n", |
There was a problem hiding this comment.
No need for the outer loop if you are breaking it in the first iteration
Owner
Author
|
Hi Emma,
Do you need me to correct it ?
the reason i had a loop was cuz thats what the instructions for part 1 was
telling us to do.
I just thought maybe part 2 will build more on this and we will do a
complete loop.. but it didn't sorry.
Do you need me to change it ?
thanks
TJ
…On Thu, May 16, 2024 at 5:33 PM Emma ***@***.***> wrote:
***@***.**** approved this pull request.
------------------------------
In 02_assignments/assignment_2.ipynb
<#2 (comment)>
:
> + "for file_path in all_paths:\n",
+ " with open(file_path, 'r') as f:\n",
+ " # Read the contents of the file into 'contents'\n",
+ " contents = f.readlines()\n",
+ " # Display the contents of the first file\n",
+ " print(f\"Contents of {file_path}:\")\n",
+ " for line in contents:\n",
+ " print(line.strip()) # Strip removes leading/trailing whitespace and newline characters\n",
+ " # Break out of the loop after displaying the contents of the first file\n",
+ " break\n",
+ "\n",
No need for the outer loop if you are breaking it in the first iteration
—
Reply to this email directly, view it on GitHub
<#2 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BH3A2YWNBTYJUQFOKK6RDOLZCUQ2PAVCNFSM6AAAAABHRDQDXOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDANRRHEZDMMJRHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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.
What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)
added code for python assignment-2
What did you learn from the changes you have made?
added code to assignment-2
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
not really
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
just understanding the initial problem and how the data is presented in the files.
How were these changes tested?
using the test function provided.
A reference to a related issue in your repository (if applicable)
Checklist