Write a function countChar(text) that given a string text, the function returns a dictionary of characters...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
It appears youd like to write a Python function countChar that takes a string as input and returns a ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Assignment 5: Hash Table implementation andconcordance There are three parts to this assignment. In the first two parts,you will complete the implementation of a hash map and aconcordance program. In...
-
An airplane has a ground velocity of 4 0 0 km / h , [ N 6 0 W ] . The plane is affected by a 9 0 km / h wind which is coming from the direction [ N 8 0 E ] . Determine the magnitude and the direction...
-
What are the differences in the combustible properties of lignite, bituminous coal, and anthracite coal?
-
What are the six fundamental characteristics of a relational database model?
-
What is the main purpose of GAAP and the main purpose of the tax laws?
-
A traveling production of Jersey Boys performs each year. The average show sells 1,000 tickets at $60 a ticket. There are 120 shows each year. The show has a cast of 75, each earning an average of...
-
Tom the tech used to love building computers and game boxes in his parent's garage. Now that he has a job in tech, his boss tells him which projects to work on and enforces company rules that Tom...
-
It has been proposed that oxygen be separated from nitrogen by absorbing and desorbing air in water. Pressures from 101.3 to 10,130 kPa and temperatures between 0 and 100C are to be used. (a) Devise...
-
Write a program in C++ to print a pattern below: 12345 2345 345 45 5
-
Performance measurement systems are usually intended to improve the eficiency and electiveness of programs or organizations (improve performance). But, very fev organizations have taken the time to...
-
Consider This What should you upload to the cloud? Consider uploading files that you cannot afford to lose, such as financial documents or scanned copies of insurance paperwork, as well as files that...
-
Italy and France are known worldwide for being the home of heritage and legacy luxury fashion goods and brands such as Gucci, Armani, Yves Saint Laurent (YSL), Chanel etc. is this an example of...
-
Identify and describe a Target Segment for the Earth's Own Oat Milk. Be sure to include a minimum of 1 variable in each of the following categories; demographic, geographic, psychographic and...
-
Teams, Ethics, Culture, and Diversity Describe a team that you have been on recently. Assess what made it effective or ineffective. Support your views with material on Teams Evaluate an ethical or...
-
During the construction of a highway bypass, earth moving equipment costing P400,000 was purchased for use in transporting fill from the borrow pit. At the end of the 4-year project, the equipment...
-
The 2017 financial statements of the U.S. government are available at: https://www.fiscal.treasury.gov/fsreports/rpt/finrep/fr/fr_index.htm Use these to answer the following questions: a. Statement...
-
Youve seen how to create mutual class friends. Can you create a more restricted form of friendship in which only some members of Class B are friends to Class A and some members of A are friends to B?...
-
What would the following code fragment print if it were part of a valid program? int j = 5; while ( ++j < 9) cout < < j++ < < endl;
-
What does the following preprocessor directive do? #include
-
An artificial satellite of mass \(m=2.5\) ton is in a circular orbit around the Earth at a distance of \(1600 \mathrm{~km}\) from the surface. Determine the magnitude of the satellite's angular...
-
We normally think that dissipative forces tend to decrease the velocity of an object. This is correct for isolated systems. Consider the case of an artificial satellite of mass \(m\) in a circular...
-
A meteorite is at a distance from the center of the Earth equal to 5 times the Earth's radius \(R_{T}\) with negligible speed and direction of impact toward the ground. Determine the speed with which...
Study smarter with the SolutionInn App