How to count the occurrence of a particular word with edge cases in Python
I have written the code to count the occurrence of a certain word cat in it, the code is passing only some of my test cases, it is not passing all the test, especially the edge cases. Please note, am not allowed to use inbuilt functions, just loops or conditionals for now.
Here is my code:
Code:
mystery_string = "my cat your cat"
splitword = mystery_string.split()
sum = 0
for string in