comparison python/prime.py @ 238:05728a85e19b

add prime.py
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 23 Aug 2012 15:06:23 -0700
parents
children 8593b0384d3e
comparison
equal deleted inserted replaced
237:b33d0c78132c 238:05728a85e19b
1 #!/usr/bin/env python
2
3 def prime(number):
4 half = int(number / 2)
5 for i in range(2, half):
6 if not number % i:
7 return False
8 return True
9
10 if __name__ == '__main__':
11 import sys
12 for arg in sys.argv[1:]:
13 print prime(int(arg))