I am new to Python. The following code confuses me and I don't understand properly how it works, especially the code block if num%x==0
. Can anybody explain it?
num=int(input("Enter a number: "))
for x in range(2,num):
if num%x==0:
print("{} is not prime".format(num))
break
else:
print ("{} is prime".format(num))