Question: Write a function count_unique_Lines which takes an input an open file object file that supports reading and returns the number of distinct lines of Tile.

 Write a function count_unique_Lines which takes an input an open file

Write a function count_unique_Lines which takes an input an open file object file that supports reading and returns the number of distinct lines of Tile. For instance, if nanes.txt consists of the following lines ALICE BOB CAESAR BOB and file has been obtained using open' names.txt'), then count_unique_lines (file) should evaluate to 3. You may assume that the final character of each line is the newline character 'n' Do not attempt to use the function open or call the close method of file In 1: def count_unique lines (file): # YOUR CODE HERE raise Not ImplementedError() In 1: import 10 assert 3 - count_unique_lines(io. StringIO ("ALICE) BOBINCAESAR BOBSn")) In [ 1

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!