Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A Complete Guide To Data Science Essentials

Authors: Miguel

1st Edition

9358684992, 978-9358684995

Students also viewed these Databases questions