hamdivazim/usefulib

Usefulib Idea - Character Identifier

Opened this issue · 0 comments

Describe your idea
Unlike #5, this usefulib idea is more targeted towards beginners :). The usefulib should be able to get a character and a string (and an option for case-sensitivity if you're up to it) from the user and should return a list/tuple that contains:

  • Whether the character was in the string ( bool )
  • How many occurences of the character there are in the string ( int )
  • At which indexes does the character come up ( tuple(int) )

Example Input:

char_identifier("s", "Sally sure does like slurping soup!")

Example Output:

[True, 5, (0, 6, 14, 21, 30)]

What does this solve?
This is a great extension to the built-in in operator and has many great use cases.

Is this beginner friendly?
Yes! Any beginner (or even advanced programmers) can work on this - it is a great way to get started contributing to usefulib!

Any starter code?

def  character_indentifier(char, string):
    result = []

    for i, letter in enumerate(string):
        # Process here!

    return result