title: how to modify element of list in python
body: <p>Given a list of filenames, we want to rename all the files with extension .hpp to the extension h. To do this, we would like to generate a new list called newfilenames, consisting of the new filenames. Fill in the blanks in the code using any of the methods you’ve learned thus far, like a for loop or a list comprehension.</p>
  <pre class="lang-py prettyprint-override"><code>filenames = [&quot;program.c&quot;, &quot;stdio.hpp&quot;, &quot;sample.hpp&quot;, &quot;a.out&quot;, &quot;math.hpp&quot;, &quot;hpp.out&quot;]
  # Generate newfilenames as a list containing the new filenames
  # using as many lines of code as your chosen method requires.
  </code></pre>
  <hr />
  <pre class="lang-py prettyprint-override"><code>print(newfilenames) 
  # Should be [&quot;program.c&quot;, &quot;stdio.h&quot;, &quot;sample.h&quot;, &quot;a.out&quot;, &quot;math.h&quot;, &quot;hpp.out&quot;]
  </code></pre>