I am an absolute beginner of python. I had coded a program for checking whether a number is prime or not. but it is giving me the above type error
What is the meaning of that error and how should I resolve it?
I saw the questions with same title. but I didn't understand how to resolve it. so I am asking this question.
num = ( "which no. u want to check prime or not:" )
i = 1
k = 0
while(i <= num):
if(num % i == 0): #idle is showing type error here
k=k+1
i=i+1
if(k == 2):
print "%d is prime number" % num
else:
print "%d is not a prime no" % num
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…