title: In Python, how might one replace a word within a string with a random item from a list?
body: <p>I'm trying to take a certain character formation <code>_n_</code> and replace it with a random string from an array.</p>
  
  <p>In wordlibrary.py:</p>
  
  <pre><code>    import random
  
      nouns =   ['wombat','zebra','elephant','lamp','desk','computer','python','castle','king','scribble','doodle','motorcycle','car','train','plane']
  
      def chooseNoun():
          randomNoun = random.randint(0,len(nouns))
          nounChoice = nouns[randomNoun-1]
          return nounChoice
  </code></pre>
  
  <p>Now, in storyCreator.py:</p>
  
  <pre><code>    import wordLibrary
  
      originalString = input("Type a sentence or story. Use \'_n_\' to denote a noun, \'_adj_\' to denote an adjective, \'_v_\' to denote a verb, \'_adv_\' to denote an adverb, or \'_l_\' to denote a location.     Type Here: ")
  
      nounCheck = '_n_'
  </code></pre>
  
  <p>How can I find <code>_n_</code> in the string and replace it with a random word from the list each time?</p>