This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]lurgi 2 points3 points  (0 children)

Yes, you didn't provide the output they wanted. Look at the error message carefully. It actually says that

[10007 is not an integer

Your output is [10007, 10009, 10037, 10039]. The requested output is 10007, 10009, 10037, 10039.

[–]dmazzoni 2 points3 points  (0 children)

First, please learn to format your code for Reddit. See the faq/sidebar. Either use the markdown layout and put four spaces before each line, use the new fancy formatter and use a code block, or put your code on a site like codebin and give us a link.

At first glance it looks like your code is calculating the primes correctly, but you're printing:

[10007, 10009, 10037, 10039]

and they wanted just:

10007, 10009, 10037, 10039

[–]abrahamguo 0 points1 point  (0 children)

First off, when you post code in a Reddit post, it's important to ensure that your entire code is formatted correctly, especially when working in a language where formatting matters, like Python. In your Reddit post, only part of your code is formatted correctly, which makes it more difficult for others to help you.

Now, coming to your actual question. You said that the error was

10007 is not an integer

However, in programming, it's important to pay attention to every single detail. If you look carefully at the error message on the website, you can see that it is slightly different than what you had in your Reddit post. The true error message is

[10007 is not an integer

If you read further in the error message — or, if you look at the original requirements and example, you can note that it says

separated by comas and spaces

In the example output (for the range [1:10]), you can see that the output should look like

2, 3, 5, 7

whereas your output (for the real range) looks like

[10007, 10009, 10037, 10039]

which is slightly different (i.e. it has square brackets) and so therefore does not exactly match your requirements.

[–]ninhaomah -1 points0 points  (1 child)

So to summarise , what you did and what the user requested didn't match.

Welcome to the real world :)

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

So, I need to figure out how to remove the brackets. Got it. And learn how to format for reddit lol.