Skip to content

Instantly share code, notes, and snippets.

View bbookman's full-sized avatar

Bruce Bookman bbookman

View GitHub Profile
@bbookman
bbookman / words_more_than_4.py
Created December 26, 2018 23:06
Python List Comprehension: Find words with more than 4 letters
'''Find all of the words in a string that are less than 4 letters'''
sentence = 'On a summer day somner smith went simming in the sun and his red skin stung'
examine = sentence.split()
result = [word for word in examine if len(word) >=4]
print(result)
@bbookman
bbookman / nested.py
Created December 27, 2018 04:19
Python List Comprehension: Nested
'''
Use a nested list comprehension to find all of the numbers from 1-100 that are divisible by any single digit besides 1 (2-9)
'''
#old school
no_dups = set()
for n in range(1, 100):
for x in range(2,10):
if n % x == 0:
no_dups.add(n)

Keybase proof

I hereby claim:

  • I am bbookman on github.
  • I am trentreznor (https://keybase.io/trentreznor) on keybase.
  • I have a public key ASAuct0Zg4DPo-WHmFXV3e47Xt9K7ZD2wnE-8ZKJauVCQAo

To claim this, I am signing this object: