Filename: loansv2.py Also submit: A screenshot (or download) of your plot Input files: Download debt_vs_tuition2.txt, and save it in the same directory as your loansv2.py file You'll need to open and read the file twice for this problem. Lists are not permitted in this homework, and you'll process the file using while loops. This problem has basically the same data about student loans that HW2 had, except more of it, and now we're more interested in the debt-to-tuition ratio. The file has: ● School name Average debt per student (federal loans) Yearly tuition ● ● Open the file and read in all the data so that you can compute the average debt for each school as a fraction of total tuition. You can assume that a given student's total tuition is the yearly tuition x4. (For example, northeastern's debt is $24,500 and tuition is $57,592, so our fraction would be 24500/(57592 x 4) = .106.) Determine the average debt to tuition fraction over all schools in the file, so that you can later plot each individual school's fraction against this average. Now that you have the average, you'll need to open the file a second time, and read in all the data again, this time plotting it against the average. Compute the same debt-to-tuition fraction for each school, and plot in one color if it's above the average, and a different color if it's at or below average. Create a scatterplot with tuition on the x axis, and debt fraction on the y axis. For full credit under communication, your plot must have: A title ● Labels on the x and y axes Reasonable x-limit and y-limit A horizontal line showing the average debt fraction, correctly labeled

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Solve this in Python code

Filename: loansv2.py
Also submit: A screenshot (or download) of your plot
Input files: Download debt_vs_tuition2.txt, and save it in the same directory as your
loansv2.py file
You'll need to open and read the file twice for this problem. Lists are not permitted in this homework,
and you'll process the file using while loops.
This problem has basically the same data about student loans that HW2 had, except more of it, and now
we're more interested in the debt-to-tuition ratio. The file has:
● School name
Average debt per student (federal loans)
Yearly tuition
●
●
Open the file and read in all the data so that you can compute the average debt for each school as a
fraction of total tuition. You can assume that a given student's total tuition is the yearly tuition x4. (For
example, northeastern's debt is $24,500 and tuition is $57,592, so our fraction would be 24500/(57592 x
4) = .106.) Determine the average debt to tuition fraction over all schools in the file, so that you can later
plot each individual school's fraction against this average.
Now that you have the average, you'll need to open the file a second time, and read in all the data again,
this time plotting it against the average. Compute the same debt-to-tuition fraction for each school, and
plot in one color if it's above the average, and a different color if it's at or below average.
Create a scatterplot with tuition on the x axis, and debt fraction on the y axis. For full credit under
communication, your plot must have:
A title
●
Labels on the x and y axes
Reasonable x-limit and y-limit
A horizontal line showing the average debt fraction, correctly labeled
Transcribed Image Text:Filename: loansv2.py Also submit: A screenshot (or download) of your plot Input files: Download debt_vs_tuition2.txt, and save it in the same directory as your loansv2.py file You'll need to open and read the file twice for this problem. Lists are not permitted in this homework, and you'll process the file using while loops. This problem has basically the same data about student loans that HW2 had, except more of it, and now we're more interested in the debt-to-tuition ratio. The file has: ● School name Average debt per student (federal loans) Yearly tuition ● ● Open the file and read in all the data so that you can compute the average debt for each school as a fraction of total tuition. You can assume that a given student's total tuition is the yearly tuition x4. (For example, northeastern's debt is $24,500 and tuition is $57,592, so our fraction would be 24500/(57592 x 4) = .106.) Determine the average debt to tuition fraction over all schools in the file, so that you can later plot each individual school's fraction against this average. Now that you have the average, you'll need to open the file a second time, and read in all the data again, this time plotting it against the average. Compute the same debt-to-tuition fraction for each school, and plot in one color if it's above the average, and a different color if it's at or below average. Create a scatterplot with tuition on the x axis, and debt fraction on the y axis. For full credit under communication, your plot must have: A title ● Labels on the x and y axes Reasonable x-limit and y-limit A horizontal line showing the average debt fraction, correctly labeled
1 Smith
2 24500
3 57592
4 Lesley
5 19750
63000
Brown
22316
9 62304
BU
26716
59816
BC
867FAWNI
PERE`°º×~~~~~~~≈º
10
11
12
13
14
15
16
17 21120
608
18
19
Harvard
20
23912
21 55587
22
23
25
24 60703
26
19268
61706
Dartmouth
27
28
29
30
Harvey Mudd
24572
Amherst
20964
61150
Williams
16098
59660
Transcribed Image Text:1 Smith 2 24500 3 57592 4 Lesley 5 19750 63000 Brown 22316 9 62304 BU 26716 59816 BC 867FAWNI PERE`°º×~~~~~~~≈º 10 11 12 13 14 15 16 17 21120 608 18 19 Harvard 20 23912 21 55587 22 23 25 24 60703 26 19268 61706 Dartmouth 27 28 29 30 Harvey Mudd 24572 Amherst 20964 61150 Williams 16098 59660
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education