subject

I'm taking a Python course and I'm having trouble figuring out how to write a code to complete this task: Implement the build_dictionary() function to build a word frequency dictionary from a list of words.

Ex: If the words list is:

["hey", "hi", "Mark", "hi", "mark"]
the dictionary returned from calling build_dictionary(words) is:
{'hey': 1, 'hi': 2, 'Mark': 1, 'mark': 1}
Ex: If the words list is:
["zyBooks", "now", "zyBooks", "later", "zyBooks", "forever"]
the dictionary returned from calling build_dictionary(words) is:
{'zyBooks': 3, 'now': 1, 'later': 1, 'forever': 1}
The main code builds the word list from an input string, calls build_dictionary() to build the dictionary, and displays the dictionary sorted by key value.
Ex: If the input is:
hey hi Mark hi mark
the output is:
Mark: 1
hey: 1
hi: 2
mark: 1

Thanks for your help!

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
How do you set up a slide show to play continuously, advancing through all the slides without requiring your interaction? a. click set up slide show, and then select the loop continuously until ‘esc' and show without narration options. b. click set up slide show, and then select the loop continuously until ‘esc' and use timings, if present options. c. click set up slide show, and then select the show presenter view and use timings, if present options. d. click set up slide show, and then select the show without animation and browsed at a kiosk (full screen) options.
Answers: 3
question
Computers and Technology, 23.06.2019 08:00
Which argument is not a valid filter? does not equal this quarter filter by cell color all of these are valid filter arguments.
Answers: 2
question
Computers and Technology, 24.06.2019 00:40
To maintain clarity and focus lighting might be needed
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
When writing a business letter, how many times can you use the same merge field in a document? once once, unless using the address block feature unlimited it will depend on the type of document you choose
Answers: 1
You know the right answer?
I'm taking a Python course and I'm having trouble figuring out how to write a code to complete this...
Questions
question
Social Studies, 16.06.2021 18:10
question
Geography, 16.06.2021 18:10
question
Mathematics, 16.06.2021 18:10
question
English, 16.06.2021 18:10
question
Mathematics, 16.06.2021 18:10
question
Mathematics, 16.06.2021 18:10
Questions on the website: 13722363