def primecheck(num):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
return False
break
else:
return True
Im trying to make a function that checks if an input is prime or not. This code does return True if I enter a prime number, but it also enters true whenever I enter a multiple of a prime number? Why is this happening
thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…