Question: Python 3.0 -3.5 def sentence_count(file_variable): ------------------------------------------------------- Counts the number of sentences in a file. A sentence ends with one of '.', '?', or '!'.

Python 3.0 -3.5

def sentence_count(file_variable): """ ------------------------------------------------------- Counts the number of sentences in a file. A sentence ends with one of '.', '?', or '!'. Use: n = sentence_count(file_variable) ------------------------------------------------------- Preconditions: file_variable - text file to search (file - already open for input) Postconditions: returns n - number of sentences in the file (int) ------------------------------------------------------- """ 

Hint: split is not always your friend.

txt file:

It appears that Ontario's Point Pelee National Park has lost its point. The southernmost tip of Canada is in the park, near the town of Leamington. There have always been several hundred metres of sand jutting out from the mainland. But park officials say recent high winds have washed away the sand point and all that remains is a platform. The park advertises itself as the southernmost tip of Canada's mainland, at the same latitude as northern California, and attracts more than 400,000 visitors per year. A park official says a no swimming sign that used to mark the southernmost point washed up on a beach in Madison, Ohio, about 100 kilometres across Lake Erie. Officials say the sand patterns at the point change frequently, but this is the first time the point has disappeared completely. 

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!