x-1? the instructions say you need
x-1, since you don't want to include x (otherwise the program wouldn't function) but range doesn't include
x, so i don't see why you need
-1 as well
for the rest, a function ends the moment a return keyword is reached, in your case in the first run of the loop, because either if is true, or else will run.
change the indention of else and return True so you get a
for/else instead of a
This way, True is only returned after the loop is finished running. Which means the number is indeed a prime.
I have a question, couldn't you find a similar topic to solve your problem? i answer this question multiply times a week