Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have been struggling on this question for a while now, any advice on how to edit this code? The code I have: 5.5 bar

I have been struggling on this question for a while now, any advice on how to edit this code?

The code I have:

"""5.5 bar chart.

Author: Cole Lindsey Version: Feb 26th, 2023

Honor Code and Acknowledgments: This work complies with the JMU Honor Code. """

def print_bar(label, length): """Print a single row of a bar chart.

The length argument will be converted to an int in order to determine the number of "=" symbols to use. For example:

>>> print_bar("Ruby", 3.9) Ruby : ===

Args: label (str): The label for this bar length (float): The length of the bar """ print(f"{label:

def print_border(data): """Print a correctly-sized border of '-' characters.

Print a number of '-' symbols equal to the maximum value in data (converted to an integer), plus 11.

Args: data (list): floats that will determine the length of the bars """ print('-' * (max(data) + 11))

def print_bar_chart(labels, data): """Print a nicely formatted bar chart.

The chart will have one row for each of the five entries in the two provided lists.

Args: labels (list): label strings data (list): floats that will determine the length of the bars """ print_border(data) for label, length in zip(labels, data): print_bar(label, length) print_border(data)

if __name__ == "__main__":

# Don't change this! Just finish the functions above.

l1 = ['Python', 'Java', 'JavaScript', 'C#', 'PHP'] d1 = [29.9, 19.1, 8.2, 7.3, 6.2] print_bar_chart(l1, d1)

Requirements: image text in transcribed

The errors I keep getting: image text in transcribed

"" "Print a nicely formatted bar chart. Author: NAME Version: DATE Honor Code and Acknowledgments: This work complies with the JMU Honor Code. def print_bar(label, length): " " Print a single row of a bar chart. The length argument will be converted to an int in order to determine the number of "=" symbols to use. For example: print_bar( "Ruby", 3.9) Ruby Args: label (str): The label for this bar length (float): The length of the bar raise NotImplementedError() def print_border(data): " " "Print a correctly-sized border of '-' characters. Print a number of ' ' symbols equal to the maximum value in data (converted to an integer), plus 11. Args: data (list): floats that will determine the length of the bars raise NotImplementedError() def print_bar_chart(labels, data): " " Print a nicely formatted bar chart. The chart will have one row for each of the five entries in the two provided lists. Args: labels (list): label strings data (list): floats that will determine the length of the bars raise NotImplementedError () if ___ name ==" main_": \# Don't change this! Just finish the functions above. 11=[ 'Python', 'Java', 'Javascript', 'C\#', 'PHP'] d1=[29.9,19.1,8.2,7.3,6.2] print_bar_chart(11, d1) Autograder Results Results Code Check submitted files (0.000.0] 211 tegairnd filme Mutaitturi: Check that the solution uses no loops (0.0/0.0) Teat Pailed: 8 1= 1 : Q laapa sot allowed This teat was required. dli of the following teate will fail autoatieally. Docstring checks. (0.0/1.0) Test Failed Yailed regaired test, Check that the colution ases no loopa PEP 8 checks. {0.001.0} Test Tailed: Pailed reguired test: Cherk that the solution ases no loope Test print_border function (0,0/1.0) The gailad: yailud reqguizuci tant: Ctack that the salution anns no laspa Test print bar function: 0 (0.0va.5) Teat Pailed: Failed required teat: Cheek that the solution asea no loopa Test print_bar function: 1 (0.0.0.5) Test Zailed Failed reguired test, check thst the solution ases no loope Test print_bar function: 3(0.0.0.5) Test Failed: Pailed reguired test: Cherk that the solution ases no loops Test print_bar function: 4(0.0/0.5) Test print_bar function: 2(0.0/1.0) Teat Pailed: Failed required teat: Cleek that the solution asea mo loepa Test print bar_chart function 0.0/2.0) Test Falled: Failed reguired testt cbeck thst the solution ases no loopa

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions