Question: Write a function countChar(text) that given a string text, the function returns a dictionary of characters and their counts used in text. You need

Write a function countChar(text) that given a string text, the function returns a dictionary of characters

Write a function countChar(text) that given a string text, the function returns a dictionary of characters and their counts used in text. You need to count only characters 'a' to 'z', all upper characters should be treated as lower characters ('A' should be counted as 'a'). For example for the function call: countChar('Hello World'). returns: {'h': 1, 'e': 1, '1': 3, 'o': 2, 'w': 1, 'r': 1, 'd': 1} 1 def countChar (text): 2 495AWN 3 Save & Run 7 # write your code here Load History 5 # testing 6 print (countChar('Hello World')) Show CodeLens

Step by Step Solution

3.56 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

It appears youd like to write a Python function countChar that takes a string as input and returns a ... View full answer

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!