Skip to content

Instantly share code, notes, and snippets.

@alexanderankin
Created December 1, 2016 14:35
Show Gist options
  • Select an option

  • Save alexanderankin/cf2a44d12e2d3ee42ebe6a3c533e6830 to your computer and use it in GitHub Desktop.

Select an option

Save alexanderankin/cf2a44d12e2d3ee42ebe6a3c533e6830 to your computer and use it in GitHub Desktop.
import random
NOUNS = [ "wings", "flowers", "Uggs", "bees", "tomatoes", "carrots", "teeth" ]
VERBS = [ "shoot", "fall", "walk", "jump", "butcher", "swim", "sleep", "dive" ]
ADJECTIVES = [ "ugly", "blue", "tart", "smelly", "yellow", "fleshy" ]
ADVERBS = [ "anxiously", "willfully", "angrily", "happily", "grossly", "hungrily"]
def makeSentence():
a = random.choice(ADJECTIVES)
n = random.choice(NOUNS)
v = random.choice(VERBS)
ad = random.choice(ADVERBS)
sentence = " ".join([a, n, v, ad])
sentence = " The " + sentence + ".\n"
# print sentence
return sentence
def saveSentence(sentence, handle):
if handle.closed: return;
handle.write(sentence)
fn = "output.txt"
fh = open(fn, 'w')
for i in range(5):
saveSentence(str(i) + " " + makeSentence(), fh)
fh.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment