Skip to content

Instantly share code, notes, and snippets.

@autocorr
Last active August 29, 2015 14:21
Show Gist options
  • Save autocorr/c64020fd24e8ed2062aa to your computer and use it in GitHub Desktop.
Save autocorr/c64020fd24e8ed2062aa to your computer and use it in GitHub Desktop.
simple prime checker
#!/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