Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

1.5 Describe the origins of the medical model of abnormal behavior.

Answered: 1 week ago

Question

Prepare an electronic rsum.

Answered: 1 week ago