Question: using Python, write a function that generates the bathroom code using the input as an argument in the followimg document: alrodrig.com/courses/4465/keypad_input.txt Given the 10 digit

 using Python, write a function that generates the bathroom code using
the input as an argument in the followimg document: alrodrig.com/courses/4465/keypad_input.txt Given the
using Python, write a function that generates the bathroom code using the input as an argument in the followimg document:
alrodrig.com/courses/4465/keypad_input.txt

Given the 10 digit keypad installed on the bathroom doors BSDEG O O O O * Each day a new set of instructions will be emailed to everyone in the office. Each line of instructions corresponds to one button press. Always start at the number 5. Each button to be pressed can be found by starting on the last button pressed and moving to the adjacent buttons on the keypad: U moves up; D moves down; L moves left; and, R moves right. For example, if your instructions are: UUUUULLLLL DRRRRDDDD LDDDDDDDD UURRRRRRR you start at 5 and move up to 2. Since you can't go up any further on the keypad you stop at 2. Now, move teft to 1. Again, since you can't go left any further on the keypad, you stop at 1. So, your first button is 1. Starting at the last button pressed, you now move down one button to 4 then right two times to 6 and down once to 9. So, you now end up at 9, your second number. Continuing on from 9, you move left one and down one to e. Your third number is e. . Finally, from you move up two to 5 and right one to 6. Your last number is 6, So, given the above instructions, the code for the bathroom key-lock is 1986

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!