Please write a Python program to create a histogram. It must read text from stdin and…
Jump to turn (16)
- 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
- 7The default output width of 80 does not take into account the entire width of th
- 8Note that when you calculate width\output\line you don't know the length of any
- 9Let's make the generation of the header stats optional depending on a command li
- 10Please also allow for the use of a -w option followed by the required width of t
- 11Yes. I think might be OK. Please show the entire program now.
- 12Great. An optimisation hint would be not to calculate values which are not neede
- 13Similarly, the console width need not be determined in all circumstances.
- 14What is also required is a '-h' option. If supplied then the program will not do
- 15Great. Please display the entire program.
- 16Now generate an English specification of the program in its current version so t
- 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.