LScarpinati

Random words generator

Sep 17th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import random
  2.  
  3. def make_strange_words(num,file1,file2):
  4.     """
  5.     Takes 2 word list and combine words randomely.
  6.     Print n words : num
  7.     """
  8.     for n in range(1,num):
  9.         word1 = random.choice(open(file1).readlines()).rstrip('\n')
  10.         word2 = random.choice(open(file2).readlines()).rstrip('\n')
  11.         print(word1 + word2)
Advertisement
Add Comment
Please, Sign In to add comment