= = Suppose the text file myname.txt contains three lines, each terminated by a newline ('\n'). Suppose the code below i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
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

Post by answerhappygod »

Suppose The Text File Myname Txt Contains Three Lines Each Terminated By A Newline N Suppose The Code Below I 1
Suppose The Text File Myname Txt Contains Three Lines Each Terminated By A Newline N Suppose The Code Below I 1 (53.82 KiB) Viewed 18 times
= = 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!
Post Reply