Question: can you tell me whats wrong with my code? QUESTION: Write a python program to open the test file provided and write the contents of
can you tell me whats wrong with my code?
QUESTION:
Write a python program to open the test file provided and write the contents of this file to a new file called XXXXXXtxt while adding line numbers to each line in the new file. You will also write your name and section number as the final line of this new file. The program should then output the number of lines in the file with a meaningful message to the user like "The file has XX lines". The number of lines provided to the user doesn't need to include any additional lines you add for your name and section number.
Output a message to the user thanking them from using your program that includes your first and last name.
My code:
Fname opentestpython.txtr
Lname openXXXXXXtxta
lineCount
while True:
line Fname.readline
if lenline:
break
printline end
Fname.close
myOutput.close
Lname.write: formatlineCount
Lname.writeFname Lname Sec. The file has lines". formatlineCount
while True:
line Lname.readline
if lenline:
break
Fname.close
printThank you for using my program Fname Lname"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
