Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Count X #218

@oldoc63

Description

@oldoc63

This time we are going to count the number of occurrences of a certain letter within a string. Our function will accept a parameter for a string and another for the character which we are going to count. For example, providing the word "mississippi" and the character 's' would result in an answer of 4. These are the steps we are going to take:

  1. Define the function to accept two parameters. word for the input string and x for the single character
  2. Create a counter to keep track of the occurrences
  3. Loop through every letter in the string. If the current letter is equal to the input letter, increase our counter
  4. Return the counter after looping through the entire string.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions