Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Checkpoint 3: Putting it all together Now, we are going to put these to a file called check3.py. gether. Copy your code from the previous
Checkpoint 3: Putting it all together Now, we are going to put these to a file called check3.py. gether. Copy your code from the previous checkpoint to As in checkpoint 2, you will ask from the user a starting point: file nu number and the line number. You will first find the first line of the program. Then, you will construct the p rogram using found in a file y the following starting a WHILE loop, until you reach the line END/O/o/0. Write the lines you called program, py, when done, execute the recovered program. Tr points 1/5/4 4/40/2 4/42/14 Your program must report failure if your parsing fails, which would happen if you have a bug in your code for counting paragraphs and lines or an incorrect starting point is given. To complete Checkpoint 3, show your code to the TA who will test it with a given egs program. Things to think about, challenge yourself Well, you actually do not need to be told where the starting positions of all the eggs are. There is an algorithm to recover them. Can you outline it or even better write it? Hint: it involves a type of while loop to find all locations with a program line and thern some reasoning about their locations. All of these are very doable at your current level of programming and the concepts we have learnt. There is a very easy algorithm that works for some eggs. But you need to get more sophis- ticated to find all of them. Remember: they are not all that well hidden. Checkpoint 3: Putting it all together Now, we are going to put these to a file called check3.py. gether. Copy your code from the previous checkpoint to As in checkpoint 2, you will ask from the user a starting point: file nu number and the line number. You will first find the first line of the program. Then, you will construct the p rogram using found in a file y the following starting a WHILE loop, until you reach the line END/O/o/0. Write the lines you called program, py, when done, execute the recovered program. Tr points 1/5/4 4/40/2 4/42/14 Your program must report failure if your parsing fails, which would happen if you have a bug in your code for counting paragraphs and lines or an incorrect starting point is given. To complete Checkpoint 3, show your code to the TA who will test it with a given egs program. Things to think about, challenge yourself Well, you actually do not need to be told where the starting positions of all the eggs are. There is an algorithm to recover them. Can you outline it or even better write it? Hint: it involves a type of while loop to find all locations with a program line and thern some reasoning about their locations. All of these are very doable at your current level of programming and the concepts we have learnt. There is a very easy algorithm that works for some eggs. But you need to get more sophis- ticated to find all of them. Remember: they are not all that well hidden
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