Question: Write a program that creates the following 4 histograms based on the data in weight-height.csv: male heights male weights female heights female weights Redirect the
Write a program that creates the following 4 histograms based on the data in weight-height.csv:
- male heights
- male weights
- female heights
- female weights
Redirect the input from the file into your program. Example with my Windows Computer:
Get-Content weight-height.csv | python weightheight.py
Here are a some lines from the weight-height.csv file (including the header at the top)::
"Gender","Height","Weight" "Male",73.847017017515,241.893563180437 "Male",68.7819040458903,162.310472521300 "Male",74.1101053917849,212.7408555565 "Male",71.7309784033377,220.042470303077 "Male",69.8817958611153,206.349800623871
"Female",58.9107320370127,102.088326367840 "Female",65.2300125077128,141.305822601420 "Female",63.3690037584139,131.041402692995 "Female",64.4799974256081,128.171511221632 "Female",61.7930961472815,129.781407047572 "Female",65.9680189539591,156.802082613991
Here is my code so far:
import stdio import sys import stdarray a = [] while not stdio.isEmpty(): a += (stdio.readLine()).split(',') print(a) It pretty much just outputs the content. I am not sure where to go from here. Each histogram should have its own separate page of code. Every way I try to think about sorting this list I think I'm going to run into trouble. Like if I sort by float range it won't link it to the gender for the graph. If you can think of a way to solve for one of the histograms I'm sure I can reason it from there. I thought of using tuples too but I wasn't sure how to graph those using stddraw. Someone else solved the same question using pandas but I'd prefer not to do it that way because I want to actually understand the reasoning and I won't get credit for that.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
