I don't still don't understand it.
A for loop is used to repeat a piece of code n number of times, once it is done it must return the value.
if x < 2:
return False (that is a very straightforward code , if x is smaller then 2, return this False)
The next line of code should start with else. Because we specify an alternative of instructions to be executed if the if condition is not met for x.
for n in range(2, x-1):
if x % n == 0:
Hope that helps.
this answer wasn't written for you? I write specific solutions for the learner. If you want my help, post your code + error message so i can explain to you what is wrong
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.