Skip to content

Conversation

@srikar-eranky
Copy link
Contributor

Srikar Eranky

Remove_duplicates.py

  • Chapter 11
  • Practice

Added a couple hints to the practice template for sorting and counting.

Copy link

@github-actions github-actions bot left a 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.

Copy link

@github-actions github-actions bot left a 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.

Copy link
Contributor

@Citrus716 Citrus716 left a 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.

Copy link
Contributor

@abhatia1205 abhatia1205 left a 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>
Copy link

@github-actions github-actions bot left a 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.

Copy link

@github-actions github-actions bot left a 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>
Copy link

@github-actions github-actions bot left a 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.
Copy link

@github-actions github-actions bot left a 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.

Copy link

@github-actions github-actions bot left a 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.

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)

@abhatia1205
Copy link
Contributor

Ill just go ahead and merge this. Formatting seems ok.

@abhatia1205 abhatia1205 merged commit 4f2ebd3 into master Jul 29, 2020
@abhatia1205 abhatia1205 deleted the ch11-exercises branch July 29, 2020 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants