Member-only story

Interview question: Find the occurrence of a particular character in a string

Crystal X
2 min readMay 15, 2023

--

Python is a very popular programming language, being the fourth most popular programming language according to Stack Overflow’s developer survey in 2021. In the 2022 Octoverse report, Python was found to be the second most used language in GitHub. Therefore, Python is a language that is still worth learning to use in 2023.

Python is used by Intel, IBM, NASA, Pixar, Netflix, Facebook, JP Morgan Chase, Spotify, and a number of other large companies. It’s one of the four main languages at Google, while Google’s YouTube is largely written in Python. Same with Reddit, Pinterest, and Instagram.

Because of Python’s popularity, it is worth learning this language and working on mastering the algorithms because they could very well be asked at a coding interview. One such question would be to find the occurrence of a particular character in a string.

I have written a small program that will solve this question and can be used in a coding interview.

The psuedocode to count the occurrence of a particular character in a string is found below:-

  1. Defined the string, s.
  2. Convert the string to lower case because ASCII codes for upper case are different than lower case.

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

No responses yet