First time user of this group. I have a quick question about the python prime number program listed below. In the first loop of ... for x in range (2,n): .... is n = 2 in this case? If yes, why does the program correctly say it is a prime number?
I can follow the rest of the logic but and struggling with the first iteration
Thanks
for n in range (2,15) :
for x in range(2, n):
if n % x == 0:
print n, 'equals', x, '*', n/x
break
else:
print n, 'is a prime number'

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!

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.