Please write a Python program to create a histogram. It must read text from stdin and…
Jump to turn (6)
- 1Please write a Python program to create a histogram. It must read text from stdi
- 2I think an error here is not to include the width of the first two fields when d
- 3Please determine at runtime the maximum width of the text label and the numeric
- 4Yes, that looks good. But you've now turned all the values into integers. Let's
- 5When reporting each of the max and min values in the header please retain the pr
- 6The output is too wide because you fail to take into account the spaces between
- User
Please write a Python program to create a histogram. It must read text from stdin and output text to stdout. One line of output will correspond with one line of input. Each line of input will be two fields separated by a space. The first field will be a text label. The 2nd will be a numeric value. The output will be a histogram made out of ascii text characters. Each line will have three fields. The text label will be the first and will be left aligned. The 2nd will be the value, right aligned. The third will be a bar of the histogram, left aligned. The bar will have a width the length of which will be proportional to the value of the 2nd field. The maximum width of the output shall be the width of the console terminal if this can be determined, or 80 otherwise. As a header please print the maximum, minimum, mean and std deviation of the values.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.