Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

14-7: What is prejudice? What are its social and emotional roots?

Answered: 1 week ago