I have this assignment where I have to write a code to determine if a number is a prime number or not and I couldn't come up with a solution so I searched the net and found the following code( the first one) and then I wrote the exact same code but with a different name and it didn't work for numbers like 65, 75, ... and said they are prime numbers, while they aren't. Can you help me find out what I'm doin wrong! thank you in advance!
The code I copied:
num=int(input())
if num > 1:
for i in range(2, int(num/2)+1):
if (num % i) == 0:
print(num, "is not a prime number")
break
else:
print(num, "is a prime number")
else:
print(num, "is not a prime number")
my code:
addad=int(input())
if addad>1:
for i in range(2,int(addad/2)+1):
if (addad%i)==0:
print("not prime")
break
else:
print("prime")
break
else:
print("prime")