Question: Fill in the `read_file_in_reverse()` function to return a list of the lines of a file in reverse order. def read_file_in_reverse(file_name): Reads a file and

Fill in the `read_file_in_reverse()` function to return a list of the lines of a file in reverse order.

def read_file_in_reverse(file_name):

""" Reads a file and returns a list of the lines in reverse order

[IMPLEMENT ME]

1. Open and read the given file into a variable

2. Read the file line-by-line and store the lines in a list in reverse order

3. Print the list

4. Return the list

Args:

file_name: the name of the file to be read

Returns:

list: list of the lines of the file in reverse order.

"""

### WRITE SOLUTION HERE

raise NotImplementedError()

sampletext.txt file:

Because I could not stop for Death, He kindly stopped for me; The carriage held but just ourselves And Immortality.

In Python pls!

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 Databases Questions!