rpose: To practice write a list of Pecoras toa tabular text file egree of Difficulty: Moderate. n this question, your program will define a function named fnWriteState(), with two input parameter · A list of records (the list of state of all days) · A string of a path name of the output file nd there is no return values of this function. n this function, your program will write the list of state to a tabular file. It is notable that the output hould locate in the same folder of the a6.py file. In the state output file, the first line is names of the tir , I and R. And lines from the second to the last line of the output file contain every day's state of S, I a in the list of state, and also with the item of time (indicates the index of the day). Each record in the f state will be written in one line. And the items of each line will be separated by commas. Basically, ormat of the state output file is the same as the state input file. But in the state output file, both the st f being read in from the state input file, and calculated by the simulation function in Q4 are all include he first few lines of the state output file look like this: ime(day),S,I,R , 9999, 1,0 , 9998.840016, 1.0885554285714287, 0.07142857142857142 9998.66586733474, 1.1849501346490998, 0.1491825306122449

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
100%
Purpose: To practice write a list of records to a tabular text file
Degree of Difficulty: Moderate.
In this question, your program will define a function named fnWriteState(), with two input parameters:
· A list of records (the list of state of all days)
· A string of a path name of the output file
And there is no return values of this function.
In this function, your program will write the list of state to a tabular file. It is notable that the output file
should locate in the same folder of the a6.py file. In the state output file, the first line is names of the time,
S, I and R. And lines from the second to the last line of the output file contain every day's state of S, I and
R in the list of state, and also with the item of time (indicates the index of the day). Each record in the list
of state will be written in one line. And the items of each line will be separated by commas. Basically, the
format of the state output file is the same as the state input file. But in the state output file, both the state
of being read in from the state input file, and calculated by the simulation function in Q4 are all included.
The first few lines of the state output file look like this:
time(day),S,I,R
0, 9999, 1,0
1, 9998.840016, 1.0885554285714287, 0.07142857142857142
2, 9998.66586733474, 1.1849501346490998, 0.1491825306122449
Finally, do not forget to call the method of close () to close a file object.
Transcribed Image Text:Purpose: To practice write a list of records to a tabular text file Degree of Difficulty: Moderate. In this question, your program will define a function named fnWriteState(), with two input parameters: · A list of records (the list of state of all days) · A string of a path name of the output file And there is no return values of this function. In this function, your program will write the list of state to a tabular file. It is notable that the output file should locate in the same folder of the a6.py file. In the state output file, the first line is names of the time, S, I and R. And lines from the second to the last line of the output file contain every day's state of S, I and R in the list of state, and also with the item of time (indicates the index of the day). Each record in the list of state will be written in one line. And the items of each line will be separated by commas. Basically, the format of the state output file is the same as the state input file. But in the state output file, both the state of being read in from the state input file, and calculated by the simulation function in Q4 are all included. The first few lines of the state output file look like this: time(day),S,I,R 0, 9999, 1,0 1, 9998.840016, 1.0885554285714287, 0.07142857142857142 2, 9998.66586733474, 1.1849501346490998, 0.1491825306122449 Finally, do not forget to call the method of close () to close a file object.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Stack 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
  • SEE MORE 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