HELP is_prime (practice makes perfect)


#1

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


#2

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?


#3

so should it be:


#4

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.


#5

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