Skip to content

Instantly share code, notes, and snippets.

@20esaua
Last active June 4, 2018 15:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 20esaua/2d490553eb8068c31b7bfb3317141fec to your computer and use it in GitHub Desktop.
Save 20esaua/2d490553eb8068c31b7bfb3317141fec to your computer and use it in GitHub Desktop.
Refactored version
text = 'Once upon a time in the land of Tigernet there lived a wise, but $adjective wizard named James. In his dominion was all kinds of electronic $nouns and $nouns. One day, the wizard Fulton declared, \'Let us make a giant balloon and adorn it with such devices as $nouns, $adjective $nouns, and $adjective $nouns. With these devices we will measure the curvature of the $noun - a $adjective but important scientific inquiry.\' So the many citizens of Tigernet embraced the $adjective mission of their leader and began the $adjective and $adjective task of building the $nouns. They used $adjective tools to make $quantity $adjective $nouns - some were $adjective while others were $adjective. They worked $adverb for $quantity days and nights. Finally, the day came to launch. They filled the $adjective balloon and watched it $adverb rise into the $adjective $adjective sky. It was a beautiful sight.'
for wordtype in {'noun', 'verb', 'adjective', 'adverb', 'quantity'}:
for _ in range(text.count('$%s' % wordtype)):
text = text.replace('$%s' % wordtype, input('Enter a %s: ' % wordtype), 1)
print('='*80 + '\n%s' % text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment