Question: Q 3 : Given a string s , write a Python program that counts the number of occurrences of each unique character of s (

Q3: Given a string s, write a Python program that counts the number of occurrences of each unique character of s (a.k.a., histogram) and return the result in a dictionary. The order of the unique characters does not matter.
Example 1: If s = 'abcdefgaaccdef', your returned dictionary should be {'a': 3,'b': 1,'c': 3,'d': 2,'e': 2,'f': 2,'g': 1}.
Example 2: If s = 'Abcdefgaaccdef', your returned dictionary should be {'A': 1,'b': 1,'c': 3,'d': 2,'e': 2,'f': 2,'g': 1,'a': 2}.
return lcm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!