-
-
Notifications
You must be signed in to change notification settings - Fork 14
Add remove_duplicates.py to Ch.11 #35
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
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.
No linting violations have been found in this PR.
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.
No linting violations have been found in this PR.
Citrus716
left a comment
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.
Nice Problem, but I don't think the solution works all the time. I tried the list: [2, 2, 1, 2, 324, 52, 34, 324], and I got [1, 2, 2, 34, 52, 324, 324]. Let me know if you need any help.
abhatia1205
left a comment
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.
Hi Srikar.
Generally, it is bad to change a list while you are iterating over it. It messes up the loop and often leads to errors, which has happened in your case. For example, if I try the list [1,1,1,1,1,1,1], it returns [1,1], which is incorrect. I would suggest changing the code such that you are not changing the list while iterating. Having a worse space complexity by making a new list is fine because iterating and changing the list at the same time is usually bad practice.
Another note: You should make sure to specify that using the set function is NOT ALLOWED. If it was allowed, the function would just be one line of code: return list(set(array)).
Please make these changes and resubmit. Thanks!
Co-authored-by: abhatia1205 <32373316+abhatia1205@users.noreply.github.com>
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.
Lintly has detected code quality issues in this pull request.
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.
Lintly has detected code quality issues in this pull request.
Co-authored-by: abhatia1205 <32373316+abhatia1205@users.noreply.github.com>
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.
Lintly has detected code quality issues in this pull request.
Redid the solution using dictionaries, didn't realize that they were covered in Ch.9. If you plan on teaching Ch.11 before Ch.9, highly recommend that you don't use this problem.
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.
Lintly has detected code quality issues in this pull request.
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.
Lintly has detected code quality issues in this pull request.
| # write code to create newimg here | ||
| def solution1(): | ||
| """Iterating over the image here. i is a variable from 0 to the width of the image. | ||
| """Iterating over the image here. i is a variable from 0 to the width of the image. |
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.
E501: line too long (83 > 79 characters)
|
Ill just go ahead and merge this. Formatting seems ok. |
Srikar Eranky
Remove_duplicates.py
Added a couple hints to the practice template for sorting and counting.