Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1: Write a Python function, called cntWordOccur, that takes in two arguments Argument #1: It is a string that represents a string of one
Problem 1: Write a Python function, called cntWordOccur, that takes in two arguments Argument #1: It is a string that represents a string of one or more sentences. Argument #2: It is a string that represents a word. The function will count the number of times the word occurs in the sentences(s) and returns this value when called. You will return an integer value. Do not use the built-in function called cou nt def cntWordoccur (sentences, word): YOUR CODE GOES HERE >>> string of sentences- I like to eat lots and lots of ice cream" >>> word to find = lots" >>cntWordoccur(string of_sentences, word to find) Use the split0 function to separate the word of the string. The split0 function splits a string into a list. You can specify the separator. The default separator is any whitespace For example >>>string of sentences = I like to eat lots and lots of ice cream >>list_of_words string_of sentences.split() >print(list_of_words) I' , , , like , , , to, , 'eat', 'lots', 'lots, , , of, , , ice,' cream
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