Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3 please and thank you. What to Hand In Usually this appears last, but in this question, it's first so that you know what
Python 3 please and thank you.
What to Hand In Usually this appears last, but in this question, it's first so that you know what you have to hand in. As you can see, the code you develop is a small part of this work. - Your plan to complete this question: a2q2_plan. txt - Your design document: a2q2_design.txt - Your answers to the reflection questions: a2q2_reflections.txt - Your Python program a2q2.py You are allowed to use PDF. RTF. DOC files instead of TXT. Be sure to include your name, NSID, student number, course number and lecture section at the top of all documents. Problem Specification In this question you will implement a program to solve a simple task. The task itself is related to a statistical and physical model called a Random Walk. A Random Walk is a string consisting of a random sequence of the letters ' L ' and ' R '. For example: 'L R R L R'. We're going to imagine that this sequence describes a person taking a step left 'L' or right 'R' at random along a straight line. The question we want to answer is this: In terms of steps, how far away is the person after taking all the steps? We'll call this the distance, and it will always be positive (or zero). since we don't care which side the person ends up on. Here are some examples to help clarify: - 'L L L': distance is 3 - 'R L L': distance is 1 - ' RRR ': distance is 1 - ' RRR ': distance is 3 - ' R L L R': distance is 0 - 'L R R L R': distance is 1 You will be given a number of datafiles containing random walks of different lengths. Each file will contain a number of lines. Each line will be a random walk. The program you must write will open the file, read each line, and then display the distance of the random walk for that line. For example, if a datafile contained the examples above, your program would display For this question you will do the following: - You will start by creating a plan for your work. Your plan will schedule time for the following development phases: - Requirements. The specification is given above, so this part of the plan includes reading the Specification section carefully. You do not need to hand in anything for this part. - Design. Your plan will indicate when you will do the design phase (day, time, location). and how long you think it will take (duration). - Implementation. Indicate when you will work on the implementation phase (day, time, location). using your design, and how long you think it will take (duration). - Testing and debugging. Indicate when you will work on testing and debugging (day, time, location), and how long you think it will take(duration). - Final clean up for submission. Indicate when you will work on clean-up (day, time. location), and how long you think it will take (duration). You must submit this plan for grading. - You will design your program, producing a design document outlining your implementation. You will submit this design for grading. - You will record the amount of time you actually spent on each phase of the plan. You will submit this information for grading. Details Details about the Plan On page 7 is an example table that you could use to outline your plan. It has columns for the information required above. You are not required to follow your plan exactly, to the last detail. It's a plan, not a commitment. It's helpful for monitoring your progress. You might find your plan didn't account for issues and problems that came up. That's okay. Make note of those in your reflections. Details about the Design Your design document should describe your implementation in terms of the functions you'll need to complete the program. For each function, you must specify: - Pseudo-code or informal algorithm descriptions. The form of the description is up to you. - An informal description of the inputs and outputs for each function. - An informal description of any test cases you will need to check your functions. It's important for you to keep in mind that the purpose of the design is to help you, and you should not be overly worried about the format of your designStep 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