Skip to content

Instantly share code, notes, and snippets.

@kunigami
Last active January 29, 2020 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/b6e1ef75699829740cb9f2bae18cfdd6 to your computer and use it in GitHub Desktop.
Save kunigami/b6e1ef75699829740cb9f2bae18cfdd6 to your computer and use it in GitHub Desktop.
def get_words():
f = open('/usr/share/dict/words', 'r')
for line in f:
yield line.strip()
def filter_step(lines):
for line in lines:
if (line[-3:] == 'ion'):
yield line
def print_step(lines):
for w in filtered_words:
print(w)
words = get_words()
filtered_words = filter_step(words)
print_step(filtered_words)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment