Hi to the forum;
A simple question:
I want to make a prime number checker:
So if I want to test if 25 is a prime number.
i should to verify if 2 is a factor.
if it is not, i verify with 3 and 4 (not my subject if not 4 id included in not 2), and finally 5.
with a for loop,
for i in range (2, 25): if 25 % i == 0: break else: print (25, " is a prime number.")
is a wrong code because after testing 25 % 2, the conclusion where that 25 is a prime number.
So it is imperative that the condition controlled loop run's from 2 to 24(I know the exageration but It's not my subject).
What is the right procedure?