Question: QUESTION 1 3 For a biomedical experiment, the names and weights of some patients have been stored in a file patwts.dat. For example, the file
QUESTION
For a biomedical experiment, the names and weights of some patients have been stored in a file patwts.dat. For example, the file might look like this:
Darby George
Helen Dee
Giovanni Lupa
Cat Donovan
Create this data file first. Then, write a script readpatwts that will first attempt to open the file. If the file open is not successful, an error message should be printed. If it is successful, the script will read the data into strings, one line at a time. Print for each person the name in the form 'last.first' followed by the weight. Also, calculate and print the average weight. Finally, print whether or not the file close was successful. For example, the result of running the script would look like this:
readpatwts
George, Darby
Dee, Helen
Lupa, Giovanni
Donovan, Cat
The ave weight is
File close successful
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
