Answer:
def word_count(words):
return len(words.split(" "))
print(word_count("This is Python."))
Step-by-step explanation:
*The code is in Python.
Create a function called word_count that takes one parameter, words
Split the words using split function, use " " for the delimiter, and return the length of this using len function.
Note that split function will give you a list of strings that are written with a space in the words. The len function will just give you the length of this list.
Call the word_count function with a string parameter and print the result.