title: Replacing items in nested array and list-tuple
body: <p>Good day to all.</p>
  
  <p>I've been looking for a way to replace items within an array.</p>
  
  <p>Basically I have an array with nested list that looks like that:</p>
  
  <pre><code>array = [ ('a', 'a'), 'c', ('c', 'a'), 'g', 'g', ('h', 'a'), 'a']
  </code></pre>
  
  <p>Now I'm looking for a way to replace all the appearances of 'a' with 'z'.</p>
  
  <p>and I was hopping to use the following code line in order to achieve that:</p>
  
  <pre><code>new_array = [w.replace('a', 'z') for w in array]
  new_array = [ ('z', 'z'), 'c', ('c', 'z'), 'g', 'g', ('h', 'z'), 'a']
  </code></pre>
  
  <p>Yet, unfortunately I'm receiving the following error:</p>
  
  <p><strong>AttributeError: 'tuple' object has no attribute 'replace'.</strong></p>
  
  <p>I understand the main problem is caused by the use of the tuple (a, x), but they're crucial part of the desired array.</p>
  
  <p>I've spent hours looking for a way around it, And I would highly appreciate any hint in the right direction. </p>
  
  <p><strong>Your help is appreciated!</strong></p>