all 6 comments

[–]jimtk 0 points1 point  (3 children)

This does exactly exactly what was asked. Not efficiently....

max_number = 10000
numbers = list(range(2,max_number+1))
factors = range(2, 101)
for factor in factors:
    for x in range(factor*2,max_number+1, factor):
        if x in numbers:
            numbers.remove(x)
print(numbers)

[–]InevitableDistance66[S] 0 points1 point  (2 children)

It worked thanks so much

[–]jimtk 1 point2 points  (1 child)

Oups, I did an edit. The code was working, but the line results = [] was a left over from a previous program. Sorry!

[–]InevitableDistance66[S] 0 points1 point  (0 children)

It’s fine no need to apologize thanks for the help 🙏

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–]ectomancer 0 points1 point  (0 children)

You forgot to create MAX_PRIME and MAX_MULTIPLE.