what's wrong with this (trying to find a prime number)
import math
candidate=29
if (candidate/2)*2 == candidate:
print candidate, 'is even'
else:
print candidate, 'is odd'
for i in range(2,candidate):
if candidate % i == 0:
print candidate, 'is not a prime'
else:
print candidate, 'is a primo'

Hey! We 've verified this expert answer for you, click below to unlock the details :)

I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!

Why not use the following as the first line?
if (candidate%2) != 0:

Oops, that should be the reverse:
if (candidate%2) == 0:

That's better than expanding to if candidate % i == 0?

Looking for something else?

Not the answer you are looking for? Search for more explanations.

## More answers

Looking for something else?

Not the answer you are looking for? Search for more explanations.