Question: Check if there is a file created as expected ( and its content ) Sample Output File Created as below: table [ [ ,

Check if there is a file created as expected (and its content)
Sample Output File Created as below:
\table[[,studentRecord.txt,
Reading Text Data from Text File: (Use the data file created in Question 1):
Write a Python program (named YourName_SID_Lab9_2.py) with:
The function main () which:
lets user input a file name (e.g. "studentRecord.txt") for opening the data file created from Question 1; then
properly calls the readData() function to read student records (Name and Mark for programming course) from the data file below.
Also write a function readData (fname) in the same program file, which:
accepts one argument of file name string, without return
reads students' records and determines the average mark
display students' records (Student name and Mark)(See sample program output)
display the average with the decimal point for 1 digit at the end.
(Hint: may use function readlines () to read all text file content as string list, or function read () to read all text file content as one string, in readData())
IMPORTANT: the file must be closed by close () to disconnect both the program and the file.
Remark: File existence checking is needed in main () to check the file in the storage medium
Sample Input File:
\table[[,studentRecord.txt,
Check if there is a file created as expected (

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!