please code in python from typing import TextIO def clean(in_file: TextIO, out_file: TextIO) -> None: ''' in_file is a file open for reading; out_file is a file open for writing. Each line in in_file ends with a newline character. Copy each line from in_file to out_file. For any line that includes a *, do not include the first * or any following characters on that line. ''' in_file = open(in_file) # Line 1 out_file = open(out_file, 'w') # Line 2 line = in_file.readline() # Line 3 while line.strip(): # Line 4 line = in_file.readline() # Line 5 if '*' in line: # Line 6 line = line[:line.find('*')+1] + '\n' # Line 7 out_file.write(f'{line}\n') # Line 8 line = in_file.readline() # Line 9     There may be some bugs or errors in this code that prevent it from working properly. For each line, indicate: *OK* if the line is correct *REMOVE* if the line has to be removed. *CHANGE* if the line has to be changed (here, please also indicate what the line has to be changed to). # TODO: tell us what to do with each line Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

please code in python

from typing import TextIO

def clean(in_file: TextIO, out_file: TextIO) -> None:
'''
in_file is a file open for reading; out_file is a file open for writing.
Each line in in_file ends with a newline character.
Copy each line from in_file to out_file.
For any line that includes a *, do not include the first *
or any following characters on that line.
'''
in_file = open(in_file) # Line 1
out_file = open(out_file, 'w') # Line 2
line = in_file.readline() # Line 3
while line.strip(): # Line 4
line = in_file.readline() # Line 5
if '*' in line: # Line 6
line = line[:line.find('*')+1] + '\n' # Line 7
out_file.write(f'{line}\n') # Line 8
line = in_file.readline() # Line 9

 

 

There may be some bugs or errors in this code that prevent it from working properly.

For each line, indicate:
*OK* if the line is correct
*REMOVE* if the line has to be removed.
*CHANGE* if the line has to be changed
(here, please also indicate what the line has to be changed to).


# TODO: tell us what to do with each line

Line 1

Line 2

Line 3

Line 4

Line 5

Line 6

Line 7

Line 8

Line 9

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY