Question: # Exercise 1: # Define a Python function `character_freq(str)` to print out a dictionary containing the character frequency (count the number of each characters) of

# Exercise 1: # Define a Python function `character_freq(str)` to print out a dictionary containing the character frequency (count the number of each characters) of a string. # For example: # ``` # character_freq('This is a random string') # ``` # will return: # # ``` # {'d': 1, # 't': 1, # ' ': 1, # 'i': 1, # 'n': 2, # 's': 1, # 'a': 1, # 'r': 2, # 'o': 1, # 'g': 1, # 'm': 1} # ```

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 Databases Questions!