Answer:
The function in Python is as follows:
def word_beginnings(line, ch):
count = 0
lines =line.split(" ")
for word in lines:
if word[0] == ch:
count+=1
return count
Explanation:
This defines the function
def word_beginnings(line, ch):
This initializes count to 0
count = 0
This splits line into several words
lines =line.split(" ")
This iterates through each word
for word in lines:
This checks if the first letter of each word is ch
if word[0] == ch:
If yes, increment count by 1
count+=1
Return count
return count