Question: Python basic file access programming: # Exercise In the same folder of your as your program, create a data.txt with the content below: Robert,

Python basic file access programming:

# Exercise  """ In the same folder of your as your program, create a data.txt with the content below:  Robert, Jones, 2015 Michael, Taylor, 2010 William, Brown, 2037 David, Williams, 2033 James, Wilson, 2048 Paul, Lewis, 2037 """  def read_file(): """  1. read a file  Finish this function which reads the content of the data.txt and print the content line by line.  This function has no explicit return value.  """  def read_file_definite(): """  2. read a file with a definite loop  Finish this function which reads the FIRST 3 LINES of the data.txt and print them out.  This function has no explicit return value.  """  def read_file_indefinite(): """  3. read a file with an indefinite loop  Finish this function which reads the data.txt file, then process each line as CSV.  It prints all the first names of each line.  But the printing stops after printing the first occurrence of first name has 7 characters.  This function has no explicit return value.  """  def write_file(): """  4. write a file  Finish this function which reads the data.txt file , read the content line by line.  For each line it reads, it should also output one line in a out.txt file with the content below  {first name} {last name}'s office is {office}.   For example, after reading the first line, the line added to the out.txt should be  "Robert Jones's office is 2015".  This function has no explicit return value.  """  #======================================= # test for 1 read_file() print("--"*10) #test for 2 read_file_definite() print("--"*10) #test for 3 read_file_indefinite() print("--"*10) #test for 4 write_file() 

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 Databases Questions!