<prompt> Kuandika Python kazi ambayo kuhesabu idadi ya maneno katika kamba.  <response>: Sure! Heres a simple Python function that counts the number of words in a given string:pythondef count_wordsstring: Count the number of words in a string. Parameters: string str: The string to be counted. Returns: count int: The number of words in the string. Split the string into a list of words words string.split Count the number of words in the list count lenwords return countTo use this function, you can pass a string as an argument, like so:pythonmy_string This is an example sentence with seven words. word_count count_wordsmy_stringprintword_count Output: 7 