Question: pls using simple python method In this lab you will complete a series of tasks which will result in a program that can read in

 pls using simple python method In this lab you will completea series of tasks which will result in a program that can

pls using simple python method

In this lab you will complete a series of tasks which will result in a program that can read in the contents of a text file, conduct a frequency analysis of the letters appearing in the text, and draw a histogram of the results using standard output. For example, the program could be used to analyse the text of the book "The Wonderful Wizard of Oz" by L. Frank Baum. A frequency analysis would result in the table of data ('t': 14833, 'h": 11397, 'e': 20359, 'W : 49 31, '.: 12870, 'n': 9723, "d.: 8354, 'r': 9298, a:12834, b*: 2176, 'y: 3787, 'k': 1779, 'm: 3530, C:3511, s: 8938, 'v':1158, 'g .f": 3200, 'u': 4085, '1': 6781 , .i': 9188, 'z': 3171, j:151, 'p:1986, q': 133, "x': 137) 268 , Which could be shown in a histogram (ordered from most frequent letter to least frequest letter) as X. xXxX---- etoahnrisdlwuymcfgbpkvzjxq Although our ultimate goal looks quite challenging, we will start with a much smaller and simpler program and work progressively towards the more general solution. When we develop software, we typically start with a small concrete case, and slowly increase the functionality of the code, refactoring the code as required to make it easy to modify/maintain as we add more features. At every stage, we should have a working program Using standard output, it is much easier to generate a histogram that is displayed horizontally than vertically, so we will start by displaying the charts horizontally. For this first task, you must write a function called generate_histogram_01(data) that accepts a list of integer values and displays a horizontal line of X's for each element of the list, where the number of X characters on each line is equal to the value of the corresponding element. For example, if the data was the list: then the output should be: Note that the X is a capital (upper case) letter. For example Test Result generate histogram 01([1, 2, 3, 4, 5])X generate_histogram_01([5, e, 4]) xXXX

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!