n=int(input('enter number:'))
if n==1:
print(1,'is not prime number because it has only one factor')
else:
for i in range(2,n): # (2,n//2)
if n%i==0:
print(n,'is not prime number')
break
else:
print(n,'is prime number')
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter