Question
5. 3. Challenge: Fixed Length Records Fixed Length Records You will be passed the filename P, firstname F, lastname L, and a new birthday B.
5. 3. Challenge: Fixed Length Records
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.
Check It!
LAST RUN on 8/11/2018, 10:43:30 PM
Program Output
Your program output did not match the expected output. Your output: Adam Smith 11111985Theodore Anderson 03201990Monty Biscuit-Barrel 10181980Adam Smithers 10101960Ruthy Anderson 06062010 Expected output: Adam Smith 11111985Theodore Anderson 03201990Monty Biscuit-Barrel 10181980Adam Smithers 00000000Ruthy Anderson 06062010
import sys P= sys.argv[1] F= sys.argv[2] L= sys.argv[3] B= sys.argv[4]
file1 = open(P, 'r') data = file1.read() for i in range(0, len(data)): if F not in data and L not in data: data.append(i) if F in data and L in data: data.replace(B,B)
file1 = open(P, 'w') file1.write(data) file1.close()
I for the life of me can'f figure out whats going on with this.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started