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 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
Step: 1
It appears youd like to write a Python function countChar that takes a string as input and returns a ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
C++ Primer Plus
Authors: Stephen Prata
6th Edition
978-0321776402, 0321776402
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App