tdunham99

primenumbers

Jul 10th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. def is_prime(x):
  2.   if x < 2:
  3.     return False
  4.   elif x == 2 or x == 3:
  5.     return True
  6.   else:
  7.     for n in range(2, x-1):
  8.             if x % n == 0:
  9.                 return False
  10.             else:
  11.                 return True
Advertisement
Add Comment
Please, Sign In to add comment