HELP is_prime (practice makes perfect)


Hello, I really need help with my code. I don t understand why it's not working.
Thanks for the help.


Hi, @john509 ,

You have this line, but it does not begin with an if ...

x % n == 0:

What should the program do if that expression evaluates to True?

What should the program do if the for loop completes all its iterations without a divisor being found for x?


so should it be:


Hi @john509 ,

The code that you have there is good, but still needs another return statement that handles the case where the loop finishes all its iterations without having returned False. Plan that statement's indentation so that it does not become part of the for loop.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.