I realised that the solution given by the system is more of a loop-based solution than string method- based solution.
def count_char_x(word, x): occurrences = 0 for letter in word: if letter == x: occurrences += 1 return occurrences
Using the example method @mtf has shared in the first Code Challenge exercise:
def count_char_x(word, x): count = [ ] for letter in word: if letter == x: count.append(letter) return len(count)
This method could also generate the required function, using string methods.