Last active
August 29, 2015 14:21
-
-
Save autocorr/c64020fd24e8ed2062aa to your computer and use it in GitHub Desktop.
simple prime checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
def is_prime(x): | |
assert type(x) == int | |
assert x > 0 | |
if x == 2: | |
return True | |
for n in xrange(2, x / 2 + 1): | |
if not x % n: | |
return False | |
return True | |
def anti_vowel1(s): | |
vowels = 'aeiouAEIOU' | |
return ''.join([x for x in s if x not in vowels]) | |
def anti_vowel2(s): | |
vowels = 'aeiouAEIOU' | |
return filter(lambda x: x not in vowels, s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment