Python Forum
sieve of eratosthenes implementation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sieve of eratosthenes implementation
#8
(Dec-23-2019, 06:50 AM)perfringo Wrote: I actually don't see big difference between code in wiki and yours. Wiki one takes advantage of generators and don't build intermediate lists. Both use filters as this code is filter by any means:

The difference is that your code does not answer the request of OP, which is a problem that a lot of people have. The user asked a simple question. Please provide code that explains the sieve of Eratosthenes, and here you come and show them something that an admitted novice such as OP would have no chance of understanding and doesn't fit the nature of the original exercise which far predates computers.

If you wanted to show them the actual answer and then show them a better way to do it that would also be suitable but you ignored the original request and took the opportunity to show off your brainpan. This forum is about helping people understand and answer their questions. You didn't do that. You are so focused on your code that you refuse to see that. This happens in the homework forum all too often as well. Users tell OPs that the way they are doing things is wrong but that's the way that their teacher wants it done. Yes you can use a dictionary to do stuff easier, but they haven't been taught them yet. Yes list comprehension would look better but they are still on loops. If you want to help consider who you are helping, it's not that tough.

Now I stand by my assertion that you failed OP with your responses and that your code while it produces primes in not actually a proper representation of the sieve of Eratosthenes, and I'm finished with this semantic argument. You reply how you like but in the future when others search this forum for the sieve of Eratosthenes, I can tell you conclusively that they will understand my answer.
Reply


Messages In This Thread
RE: sieve of eratosthenes implementation - by Clunk_Head - Dec-23-2019, 05:15 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020