Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def is_prime(x):
  2.     n = 2
  3.     check = 0
  4.     if x < 2:
  5.         return False
  6.     else:
  7.         while n <= x:
  8.             if x % n == 0:
  9.                 check+=1
  10.                 n+=1
  11.             else:
  12.                 n+=1
  13.         if check > 1 or check == 0:
  14.             return False
  15.         else:
  16.             return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement