Previously, an x was used to represent every integer value. However, we don't have space to represent
Question:
Previously, an x was used to represent every integer value. However, we don't have space to represent large values using the approach (e.g., it would be unreadable if the values were in the hundreds or thousands). Therefore. we need to scale the bars so that each X represents a larger quantity.
We will display the bars as percentages, where the largest value in the data set is treated as 100%- The height of the other bars will be proportional to the largest value in the set. This allows us to set the size of the histogram and ensure that the data is displayed in a format that is easy to read and understand.
Write a function called generate_histogram_03 that accepts 2 arguments. The first argument should be a dictionary containing the table of data that we want to display in the histogram. The second argument is an integer representing the maximum length of a bar (number of Xs) vw'thin the table. This argument will be used to determine the scale that we will apply when drawing the bars. Use a Keyword argument max_bar_length with a default value ol 10 to set the default size of the bar.
For example, it you had a table of data as follows:
A: 2
B: 1
C: 5
and you scaled the histogram to display with the default size (where the longest bar Is 10 character long). then you would need to double the size 01 each value when displaying it (e.g. A" 4, B: 2, C: 10) so that the longest bar length is 10.
It you had values of A3, 8:5, C: 2, and you displayed with a maximum bar length of 20, then you would need to multiple each length by 4, giving A12, 8120, 0:8.
After scaling the length of each bar. you should round to the nearest integer value when you print out the number of X5. You may choose to make use of the function you defined in the previous exercise to get the largest value in a dictionary. Remember to submit all the functions you need to make your code work correctly.
For example: