Guest User

Untitled

a guest
Jun 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import re
  2. import random
  3. words = open('/usr/share/dict/words', 'r')
  4. words = words.readlines()
  5. ism = '(en|in).+'
  6. lin_words = []
  7. for word in words:
  8.     if re.match(ism, word):
  9.         word = 'lin' + word[2:]
  10.         lin_words.append(word)
  11. rand_int = random.randint(0, len(lin_words))
  12.  
  13. print lin_words[rand_int]
Add Comment
Please, Sign In to add comment