Jun-16-2020, 07:18 PM
Hey everyone,
I was presented with a challenge where I need to code a function that takes a string and then counts the number of times each character occurs in the string. Here's an example:
Input: "occurrences"
output: o1c3u1r2e2n1s1
I know the rules about no effort posts but I don't really know where to start other than taking the string, passing it into the function, and then putting the string into a list. After that do I create another list of unique characters to count them? Use a dictionary to store the results? How would I go about printing out the result like such?
I was presented with a challenge where I need to code a function that takes a string and then counts the number of times each character occurs in the string. Here's an example:
Input: "occurrences"
output: o1c3u1r2e2n1s1
I know the rules about no effort posts but I don't really know where to start other than taking the string, passing it into the function, and then putting the string into a list. After that do I create another list of unique characters to count them? Use a dictionary to store the results? How would I go about printing out the result like such?