Skip to content

Instantly share code, notes, and snippets.

@gvx
Created March 25, 2014 16:15
Show Gist options
  • Save gvx/9765299 to your computer and use it in GitHub Desktop.
Save gvx/9765299 to your computer and use it in GitHub Desktop.
2 woorden 9 letters
from random import choice
with open('/usr/share/dict/nederlands') as f:
words = f.read().split('\n')
def get_random_pair():
w1 = choice(words)
w2 = choice(words)
return len(w1) + len(w2), w1, w2
two_words_nine_letters = (w1 + ' ' + w2 for l, w1, w2 in iter(get_random_pair, None) if l == 9)
for pair in two_words_nine_letters:
print(pair)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment