Skip to content

Instantly share code, notes, and snippets.

@Ra1d7
Created January 30, 2017 23:33
Show Gist options
  • Save Ra1d7/3cfcfeb9e9f673a7759fed966b8455bc to your computer and use it in GitHub Desktop.
Save Ra1d7/3cfcfeb9e9f673a7759fed966b8455bc to your computer and use it in GitHub Desktop.
Tests if a number is a prime number or not
num = int(input('input a number: '))
lst = range(2, 1000)
la = []
for x in lst:
if x < num and x != num and x != 0 and num % x == 0:
la.append(x)
if la == []:
print('number ' + str(num) + ' is a prime number')
else:
print('number ' + str(num) + ' is NOT a prime number')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment