# count_hi **Requirements:** ```eval_rst - :ref:`fundamentals:substrings and slicing` - :ref:`fundamentals:loop through a string (while)` - :ref:`fundamentals:loop with an accumulator variable` ``` Return the number of times that the string "hi" appears anywhere in the given string. This exercise was taken from [codingbat.com](https://codingbat.com/prob/p147448) and has been adapted for the Python language. There are many great programming exercises there, but the majority are created for Java. ### Test 1 **Input:** ``` 'abc hi ho' ``` **Output:** ``` 1 ``` ### Test 2 **Input:** ``` 'ABChi hi' ``` **Output:** ``` 2 ``` ### Test 3 **Input:** ``` 'hihi' ``` **Output:** ``` 2 ``` ### Test 4 **Input:** ``` 'hiHIhi' ``` **Output:** ``` 2 ``` ### Test 5 **Input:** ``` '' ``` **Output:** ``` 0 ``` ### Test 6 **Input:** ``` 'h' ``` **Output:** ``` 0 ``` ### Test 7 **Input:** ``` 'hi' ``` **Output:** ``` 1 ``` ### Test 8 **Input:** ``` 'Hi is no HI on ahI' ``` **Output:** ``` 0 ``` ### Test 9 **Input:** ``` 'hiho not HOHIhi' ``` **Output:** ``` 2 ```