Question
Given the following file that stores the number of Computer Science graduates from the years 1970 to 2011: cs-grads.csv write a program that reads in
Given the following file that stores the number of Computer Science graduates from the years 1970 to 2011:
cs-grads.csv
write a program that reads in the file and finds all years when the percent of women graduates was greater than a given value.
- Ask the user to enter the name of the data file.
- Read the data from the file into four lists:
- Year, Total #CS Grads, #Men CS Grads, #Women CS Grads
- Ask the user to enter the percent of women they are interested in.
- Print a list of years in which the percent of female CS graduates was greater than the given number.
- The data file, cs-grads.csv is in Comma Separated Value (csv) format. If you try to open it by double-clicking, it will likely open in Excel. You can also open it as a text file by using "Open with..." Viewing it as a text file is the better way to look at the data.
- Be sure to test that the file entered by the user exists and catch the error with exception handling.
- Be sure to test that the percent entered by the user is a valid number.
- Your program should have at least these functions:
- getData - read data from the data file
- findYears - finds the years when the percent of women students was was higher than the given value
- printResults - print the list of years that were returned by findYears
- main - calls the other functions
I need other functions as well to handle exceptions.
output will look something like this:
We can format float output using the round() function in Python.
2) Using the same data file, write a program that creates a new data file containing the year and the percent of male and female CS graduates in the year.
The output file that your program will create looks like this:
I have the attached file on my computer. Just need to see how to format it, and use it to open the specified answer. Python code here, anything helps, I just need help constructing this one. Thank you.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started