Create a program named Lab9a_read.py that will read the CSV file you created in Part A. Prompt the user for the filename of the data file to read, then read all the data in the file, and print a nicely formatted table, using the output format shown below. Example output: Enter the filename: Lab9a_ThermoProperties.csv 5 MPa Data Temp [C) v [m3/kg] u [kJ/kg] h [kJ/kg] s [kJ/kgK] 0.0 20.0 40.0 0.0009977 0.04 5.03 0.0001 0.0009996 0.0010057 83.61 88.61 0.2954 166.92 171.95 0.5705 10 MPа Datа Temp [Cl 0.0 20.0 v [m3/kg] u [kJ/kg] h [kJ/kg] s [kJ/kgK] 0.0009952 0.0009973 0.12 10.07 0.0003 83.31 93.28 0.2943

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

9act1 Please help me answer this in python programming.

Create a program named Lab9a_read.py that will read the CSV file you created in Part A. Prompt the
user for the filename of the data file to read, then read all the data in the file, and print a nicely
formatted table, using the output format shown below.
Example output:
Enter the filename: Lab9a_ThermoProperties.csv
5 MPa Datа
s [kJ/kgK]
v [m3/kg]
0.0009977
0.0009996
0.0010057
u [kJ/kg] h [kJ/kg]
Temp [Cl
0.0
20.0
40.0
wan
0.04
5.03
0.0001
83.61
88.61
0.2954
166.92
171.95
0.5705
10 MPa Data
v [m3/kg]
u [kJ/kg]
h [kJ/kg]
s [kJ/kgK]
Temp [Cl
0.0
20.0
non
0.0009952
0.12
10.07
0.0003
0.0009973
83.31
93.28
0.2943
Transcribed Image Text:Create a program named Lab9a_read.py that will read the CSV file you created in Part A. Prompt the user for the filename of the data file to read, then read all the data in the file, and print a nicely formatted table, using the output format shown below. Example output: Enter the filename: Lab9a_ThermoProperties.csv 5 MPa Datа s [kJ/kgK] v [m3/kg] 0.0009977 0.0009996 0.0010057 u [kJ/kg] h [kJ/kg] Temp [Cl 0.0 20.0 40.0 wan 0.04 5.03 0.0001 83.61 88.61 0.2954 166.92 171.95 0.5705 10 MPa Data v [m3/kg] u [kJ/kg] h [kJ/kg] s [kJ/kgK] Temp [Cl 0.0 20.0 non 0.0009952 0.12 10.07 0.0003 0.0009973 83.31 93.28 0.2943
Activity #1: File read and write
Build a program for performing interpolation calculations on select properties of water. This will be done
in three different parts: Part A to write and store data in a file, Part B to read data from the file, and Part
C to interpolate and answer queries.
Part A: writing to a file
Create some random data. The data are thermodynamic properties of liquid water at varying
temperatures and two different pressures. The properties listed are as follows:
o Specific volume (v) in units of m3 /kg
Specific internal energy (u) in units of k] /kg
Specific enthalpy (h) in units of kJ/kg
o Specific entropy (s) in units of kJ/(kg · K)
It is common to use linear interpolation for temperatures not listed. So, for example, if you need
the properties at T = 25°C, you could interpolate between the property values listed for
T = 20°C and T = 40°C as a good estimate.
Create a program named Lab9a_write.py that will write the water data to a new file. Name the
new file that your code creates Lab9a_ThermoProperties.csv. Write the data to the file in the
"comma separated" format shown below. The format for each pressure is the temperature
value followed by the corresponding property values for that temperature all on one line with
the values separated by commas. There are no spaces between the numbers, only commas.
5 MPa Datа
0,0.0009977,0.04,5.03, 0.0001
20,0.0009996,83.61,88.61,0
40,0.0010057,166.92,171.95,0.5705
,0.2954
10 MPa Data
0,0.0009952,0.12,10.07,0.0003
Open the file your code created in a text editor (like Notepad) or in Spyder, and verify that the
first several lines look like the sample lines above.
Open the file your code created in Excel. The commas will not be shown and the data will be
listed in columns.
Transcribed Image Text:Activity #1: File read and write Build a program for performing interpolation calculations on select properties of water. This will be done in three different parts: Part A to write and store data in a file, Part B to read data from the file, and Part C to interpolate and answer queries. Part A: writing to a file Create some random data. The data are thermodynamic properties of liquid water at varying temperatures and two different pressures. The properties listed are as follows: o Specific volume (v) in units of m3 /kg Specific internal energy (u) in units of k] /kg Specific enthalpy (h) in units of kJ/kg o Specific entropy (s) in units of kJ/(kg · K) It is common to use linear interpolation for temperatures not listed. So, for example, if you need the properties at T = 25°C, you could interpolate between the property values listed for T = 20°C and T = 40°C as a good estimate. Create a program named Lab9a_write.py that will write the water data to a new file. Name the new file that your code creates Lab9a_ThermoProperties.csv. Write the data to the file in the "comma separated" format shown below. The format for each pressure is the temperature value followed by the corresponding property values for that temperature all on one line with the values separated by commas. There are no spaces between the numbers, only commas. 5 MPa Datа 0,0.0009977,0.04,5.03, 0.0001 20,0.0009996,83.61,88.61,0 40,0.0010057,166.92,171.95,0.5705 ,0.2954 10 MPa Data 0,0.0009952,0.12,10.07,0.0003 Open the file your code created in a text editor (like Notepad) or in Spyder, and verify that the first several lines look like the sample lines above. Open the file your code created in Excel. The commas will not be shown and the data will be listed in columns.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY