Completed the assignment 1 for python class#1
Conversation
juliagallucci
left a comment
There was a problem hiding this comment.
Code is functional, but it could be simplified using fewer lines with sorted() and string methods. No need to build a helper function. Please revise
…uce complexity and improve clarity
|
Update the assignment-1 script by following the recommendations to reduce complexity and improve clarity |
juliagallucci
left a comment
There was a problem hiding this comment.
No need to create separate functions for part B. Your code should use the third argument is_case_sensitive and return output based on whether that condition is met or not. Please revise
…the third argument is_case_sensitive as requested
|
Thanks, Julia for your comments and feedback. I really appreciate it. At the begining, I put it in that way because I thought it was easier for notebook readability and code maintenance. However, you are right, the task was asked for in one way, we need to follow the instructions. Also I learn today how to deal and switch back my local copy from the branch assignment-2, because that was the latest branch we worked and also because fortunately I made those branch independents (branchs from the main), so I didnt have issues by changing back the branch (git status, git checkout assignment-1 and I saw how the files update in my local computer after I made that on git bash) and then update my code just by moving the block code logic from the functions that i defined before to the function requested. Thanks again! "Update file assingment-1 without creating the separated function for the third argument is_case_sensitive as requested" |
TITLE: UofT-DSI | Python - Assignment 1
What changes are you trying to make?
I have added the functions for both scenarios no case sensitive and case sensitive to check if a couple of words are anagrams or not
What did you learn from the changes you have made?
I learned how to use functions and think in a step-by-step approach In my case, I started by thinking about how to count the letters in a word to reuse that in my function for non-case-sensitive and case-insensitive. Finally, in the case of the final function providing a third argument "is_case_sensitive," I then recall my two previous functions.
Was there another approach you were thinking about making?
Well, I think there are many ways to do this job. At the begining, I was thinking to use 2 for loops but then the functions became complicated, then i moved to create a function to count the letters in a word. Then i remembered there is a function to count those words, but the work was done, so I kept it. On the other hand, I also thought that maybe putting all those letters in just one single string by sorting and comparing could be another way
Were there any challenges?
Well the indentation give me some surprise when the code was not running mostly because of that.
How were these changes tested?
I tested the functions with the case provided and also with some others
Checklist