<prompt> Kujenga kazi kuhesabu idadi ya maneno katika maandishi fulani.  <response>: Sure! Heres one example of a function in Python that can count the number of words in a given text:pythondef word_counttext: split the text by spaces to create a list of individual words words text.split return the length of the list i.e. the number of words return lenwordsYou can use this function by calling it and passing a string of text as an argument, like this:pythontext This is a sample text with eight words.count word_counttextprintThe text has, count, words. The text has 8 words. 