Question: Fill in the blank using a list comprehension. With the given list of filenames, this code should rename all files with the extension . hpp
Fill in the blank using a list comprehension. With the given list of "filenames", this code should rename all files with the extension hpp to the extension. h The code function should then
point
generate a new list called "newfilenames" that contains the filenames with the new extension.
You are given a list of filenames like this:
filenames programc "stdio.hpp "sample.hppaout", "math.hpphppout"
Output the list with all of the hpp files renamed to h Leave the other filenames alone. For this question, you must use list comprehension to create the list.
tablefilenames programc "stdio.hpp "sample.hppaout", "math.hpphpp# Generate newfilenames as a list containing the new filenames# using as many lines of code as your chosen method requires.# Start your code hereprintnewfilenames# Should print programc "stdio.h "sample.haout", "math."nhppout
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
