Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started