Question: 5. 3. Challenge: Fixed Length Records USING PYTHON Fixed Length Records You will be passed the filename P, firstname F, lastname L, and a new
5. 3. Challenge: Fixed Length Records USING PYTHON
Fixed Length Records
You will be passed the filename P, firstname F, lastname L, and a new birthday B.
Load the fixed length record file in P, search for F,L in the first and change birthday to B.
Hint: Each record is at a fixed length of 16.
Then save the file.
THIS IS MY CODE AND IT IS WRONG. PLEASE CORRECT IT TO MATCH THE EXPECTED OUTPUT THAT IS PROVIDED IN THE SCREEN SHOT! ALSO PLEASE INDENT OR MAKE THE ANSWER COPY AND PASTE CAPABLE SO THAT IT WILL EXECUTE PROPERLY THANK YOU!
# Get the filepath from the command line import sys P= sys.argv[1] F= sys.argv[2] L= sys.argv[3] B= sys.argv[4]
# Your Code Goes Herefile_to_read = open(P, 'r') # open file
files = open(P, 'r') data1 = files.read() for i in range(0, len(data1)): if F not in data1 and L not in data1: data1.append(i) if F and L in data1: data1.replace(B,B) files = open(P, 'w') files.write(data1) files.close()
THIS IS MY OUTPUT AND THE EXPECTED OUTPUT:

Then save the file Check It LAST RUN on 2/18/2018, 4:03:45 PM Program Output Your program output did not match the expected output. Your output: Adam Anderson 03201990Monty Barrel 10181980Adam 10101960Ruthy Smith Biscuit- Smithers Anderson 06062010 Expected output: Adam Anderson 03201990Monty Barrel 10181980Adam 0000000ORuthy Smith Biscuit- Smithers Anderson 06062010
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
