= = Suppose the text file myname.txt contains three lines, each terminated by a newline ('\n'). Suppose the code below i
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
= = Suppose the text file myname.txt contains three lines, each terminated by a newline ('\n'). Suppose the code below i
= = Suppose the text file myname.txt contains three lines, each terminated by a newline ('\n'). Suppose the code below is executed, yielding the 4 lines of output that follows it: file_ref = open ("myname.txt","r") aline = file_ref.readline() bline = file_ref.readline() cline = file_ref.readline() print (aline.replace('-''\n') +bline+cline) file_ref.close() nd Output (4 lines with 2 line empty): Moxie = = -Bittersweet Soda Determine the original three lines in myname.txt then modify this input file to contain them. Thus, running the code should yield the given 4 lines of output. Don't alter any of the above specified code: just modify myname.txt and its contents for this problem.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!