Question
This assignment is worth 10 points, and it is count for extra point. Further reading about the histogram function: Think Python http://greenteapress.com/thinkpython2/html/thinkpython2012.html In the module
This assignment is worth 10 points, and it is count for extra point. Further reading about the histogram function: Think Python http://greenteapress.com/thinkpython2/html/thinkpython2012.html
In the module of dictionary, we learned to write the histogram function to count how many times each letter appears in a given string. Here's the histogram function:
def histogram(s): d = dict() for c in s: if c not in d: d[c]=1 else: d[c]+=1 return d
We also learned about the get function of dictionary.
Use get to write a function called ordered_histogram. You should be able to eliminate the if statement. The function should return a dictionary type at the end, which contains keys and their values in alphabetical order.
Submit the screen capture of the running program and it's output, and submit the python code in .py format.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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 Started