Is_prime


#1

cannot understand the mistake


#2

you will need a special if condition to check for values below 2, the loop won't cover it

A function ends the moment a return keyword is reached, so your function ends the first run of the loop, that can't be right, we can't determine a number is a prime number in the first run of the loop


#3

ok thank you, it turned out to be indentation issue..
it is a For and else.. added a elif statement for 2
thank you very much...


#4

yes, but this indention issue is important, do you understand why?


#5

yes.. hitting return the loop stopped .....thank you.. now i have started understanding how nested loops function.. ..


#6

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