Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

  1. Ask the user to enter the name of the data file.
  2. Read the data from the file into four lists:
  • Year, Total #CS Grads, #Men CS Grads, #Women CS Grads
  1. Ask the user to enter the percent of women they are interested in.
  2. Print a list of years in which the percent of female CS graduates was greater than the given number.

  1. 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.
  2. Be sure to test that the file entered by the user exists and catch the error with exception handling.
  3. Be sure to test that the percent entered by the user is a valid number.
  4. 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:

image text in transcribed

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:

image text in transcribed

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

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

Students also viewed these Databases questions

Question

Why should managers create a CVP graph?

Answered: 1 week ago

Question

What do you understand by MBO?

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

Prepare a constructive performance appraisal.

Answered: 1 week ago

Question

List the advantages of correct report formatting.

Answered: 1 week ago