<Below this line, add a link to the EXACT exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
break command not working
for the FOR loop i declared n=2 before the loop starts and it throws error
Traceback (most recent call last):
File “python”, line 17, in
File “python”, line 9, in is_prime
ZeroDivisionError: integer division or modulo by zero
<What do you expect to happen instead?>
will for loop always start with 0?
Replace this line with your code.
if x < 2: print "%d is not a prime number" %x return False #break else: n=2 for n in range(x): if x % n == 0: print "%d is not a prime number" %x return False #break else: print "%d is a prime number" %x return True is_prime(1015)