Skip to content

Instantly share code, notes, and snippets.

@davidbj
Created February 25, 2016 10:34
Show Gist options
  • Select an option

  • Save davidbj/4dbf95bbe38378a074e2 to your computer and use it in GitHub Desktop.

Select an option

Save davidbj/4dbf95bbe38378a074e2 to your computer and use it in GitHub Desktop.
Is Prime
ld = [2, 3, 4, 5, 6, 7]
def isPrime(n):
if n <= 1:
return False
i = 2
while i * i <= n:
if n % i == 0:
return False
i+=1
return True
len([i for i in ld if isPrime(i)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment