Question: Python creating a histogram with a dictionary I'm writing a program that creates a histogram of the frequency of words that appear in a text

Python creating a histogram with a dictionary

I'm writing a program that creates a histogram of the frequency of words that appear in a text file.

I've gotten to the point where I'm able to read the text into a dictionary with the words and their frequency as the key-value pairs, but I'm not sure how to create a histogram of it.

For example: say the text file contains "hello hello hello world this this is a test". The dictionary would be {'hello': 3, 'world': 1, 'this': 2, 'is': 1, 'a': 1, 'test': 1}

I want the program to print:

hello: ***

world: *

this: **

is: *

a: *

test: *

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!