what is my mistake in this code ?
n=int(input())
for i in range(1,11):
j=2
while j<n:
if n%j==0:
print(‘Not prime’)
else:
print(‘Prime’)
j+=1
The code breaks
Hello Anurag, can you pls tell me what are you trying to do exactly. And why are you running the loop from 1 to 11. Exactly what is your motive in this ques. Pls let me know I will help you out for sure. It is not clear to me exactly what are you asking.
Thanks 
Happy Coding !!
1 to 11 bcz I think it will run the core to 1-10 both inclusive…that’s why … And its just prime and not prime code
Hello Anurag, yes you are right the loop will run from 1 to 10 inclusive. But by this you are trying to know whether the ith no. is prime or not and if this is so. You can use break in this like this.
for n in range(1,11):
i = 2
val = True
if n < 2:
val = False
else:
while i*i <= n:
if n%i == 0:
val = False
break
i+=1
if val:
print("Prime")
else:
print("Not Prime")
And if you really want to find the no. n whether it is prime or not then you can check it like this.
n = int(input())
i = 2
val = True
if n < 2:
val = False
else:
while i*i <= n:
if n%i == 0:
val = False
break
i+=1
if val:
print("Prime")
else:
print("Not Prime")
Pls check this and let me know if it is clear to you and let me know.
Thanks 
Happy Coding !!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.