HW - Dictionary Your program is supposed to do the following: -Input: the user enters a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
HW - Dictionary Your program is supposed to do the following: -Input: the user enters a line of texts -What it does: build a histogram of the words in the line of texts. -Output: 1. the histogram of the words 2. The most frequently used word Sample output: C:/Users/Owner1/Documents/ABC-Python/ ======= RESTART: Enter a line of text cat hi cat hi cat hi red blue red Counts ('cat': 3, 'hi': 3, 'red': 2, 'blue': 1} The most frequently used word and # of frequency: The most frequently used word and # of frequency: hi 3 >>> | cat 3 For the test case, make sure to use the following test case: fish fish cat cat fish cat blue red blue www. Requirement/restriction: Do NOT use the get method provided by dictionary. For example, counts.get(name,0) should be used (watch the part 2 video lecture @6:22). As shown in the part2 lecture video, use the if-else statement (part2 video lecture @6:22) for counting words. HW - Dictionary Your program is supposed to do the following: -Input: the user enters a line of texts -What it does: build a histogram of the words in the line of texts. -Output: 1. the histogram of the words 2. The most frequently used word Sample output: C:/Users/Owner1/Documents/ABC-Python/ ======= RESTART: Enter a line of text cat hi cat hi cat hi red blue red Counts ('cat': 3, 'hi': 3, 'red': 2, 'blue': 1} The most frequently used word and # of frequency: The most frequently used word and # of frequency: hi 3 >>> | cat 3 For the test case, make sure to use the following test case: fish fish cat cat fish cat blue red blue www. Requirement/restriction: Do NOT use the get method provided by dictionary. For example, counts.get(name,0) should be used (watch the part 2 video lecture @6:22). As shown in the part2 lecture video, use the if-else statement (part2 video lecture @6:22) for counting words.
Expert Answer:
Answer rating: 100% (QA)
Python version 38 prompt and read a line as string line inputEnter a line of te... View the full answer
Related Book For
College Mathematics For Business Economics, Life Sciences, And Social Sciences
ISBN: 978-0134674148
14th Edition
Authors: Raymond Barnett, Michael Ziegler, Karl Byleen, Christopher Stocker
Posted Date:
Students also viewed these programming questions
-
Using an array that has the initial values given below, rearrange the values into a max heap using the build heap()/siftdown() algorithm and show the final order. Array Index Initial Order Final...
-
The code that you add to the Craps main method needs to do the following steps in the following order (where indicated by the comments in the code itself): 1. Declare an integer array named counts...
-
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...
-
Find an equation in cylindrical coordinates for the equation given in rectangular coordinates. y = x
-
What is an instruction trace?
-
Sulfites (compounds containing the SO32+ ions) are used as preservatives in dried fruit and vegetables and in wine making. In an experiment to test the presence of sulfite in fruit, a student first...
-
True or False: A rotating assembly with multiple parts can achieve an acceptable balance by balancing all the components separately and then putting all of them together.
-
Interpreting regression results, matching time periods, ethics Jayne Barbour is working as a summer intern at Mode, a trendy store specializing in clothing for twenty-some-things. Jayne has been...
-
What observations are made from statement of operation with a result of 1 1 % and balanced sheet result of 0 . 9 4 1 .
-
Pecos Company acquired 100 percent of Suaro's outstanding stock for $1,450,000 cash on 1/1/2014, when Suaro had the following balance sheet: Cash - $37,000 Liabilities - ($422,000) Receivables -...
-
We often hear about the importance of work-life balance, but what does this term mean, and how do we know when we have achieved it? What advice would you give an executive leader who wishes to...
-
What order are taxes calculated when determining income tax that is owed each year?
-
What would be the journal entry upon the issuance of a bill of exchange?
-
John and Mary Rose Tessler have had their home taken in foreclosure. They owe $92,000 on their original mortgage and $8,000 on their second mortgage. A contractor they hired to add on a screened...
-
A car accelerates at -1.80 m/s for 3.81 s. The car travels 26.5 m in that time. What is the final velocity of the car? Vf = [ ? ] m/s
-
In the ABC analysis, suppose that you rank all the items based on their revenue contributions from the highest to the lowest. What is the cutoff line between the B items and C items?
-
Sportiz Company manufactures sports shoes for the local market. The company has two (2) production departments: Cutting and Stitching and two (2) service departments: Information Technology (IT) and...
-
we have to compute the letter grades for a course. The data is a collection of student records stored in a file. Each record consists of a name(up to 20 characters), ID (8 characters), the scores of...
-
In Problem express the relationship between f'(x) and f(x) in words, and write a differential equation that f(x) satisfies. For example, the derivative of f(x) = e 3x is 3 times f(x); y' = 3y. f(x) =...
-
Compute the following limit for each function in Problem f(x) = | x + 1| f(2 + h) - f(2) lim h0 h
-
In Problem use interval notation to specify the given interval. The set of all real numbers from -3 to 5, including -3 and 5
-
Michael has his own consulting firm and works from home. He has the following expenses: Advertising, supplies, car expenses, computer, mortgage interest expense, real estate taxes, and utilities....
-
How would your answers change to Application Problem 8 if the transaction qualified as an excluded transaction? Problem 8 Chase would like to exchange land that he owns (adjusted basis \($140,000\)...
-
Jakari Smith is a new client and has been an investment advice provider as well as an income tax preparer for a well- established firm in the city. He would like to start his own firm as an S...
Study smarter with the SolutionInn App