Question: filenames = [ program . c , stdio.hpp , sample.hpp , a . out, math.hpp , hpp .

filenames =["program.c", "stdio.hpp", "sample.hpp","a.out", "math.hpp","hpp.out"]
# Generate new_filenames as a list containing the new filenames
# using as many lines of code as your chosen method requires.
new_filenames =___
for filename in filenames:
if filename.endswith("hpp"):
___
else:
___
print(new_filenames)
# Should be ["program.c", "stdio.h", "sample.h","a.out", "math.h","hpp.out"]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!