Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I study Python. And I could not figure out the formula to use for this problem. Please help me Overview In this lab, you will

image text in transcribed

I study Python. And I could not figure out the formula to use for this problem. Please help me

Overview In this lab, you will write a program that mimics the behavior of a 3 number rotating combination lock (see the picture) The user will enter a sequence of 3 numbers to arm the lock, then spin the lock left and right to unlock it. Unlock sequence: Every lock is programmed with a 3-number unlock sequence. To open the lock, we first set the lock's dial to position O. We then follow a simple procedure: turn the lock's dial clockwise until you reach the first number in the unlock sequence. Then turn the lock counterclockwise until you reach the second number. Finally, turn clockwise until the third number is reached. If the three numbers were correct, the lock will open We will differentiate between two types of numbers in this lab assignment: a combination value is arn integer from 0 to 39, representing the 40 different numbers on the lock. A rotation amount is any positive integer and represents how many 'ticks' (positions) the dial is turned in a particular direction For example, if a lock is programmed with the unlock sequence 30 10 15, then to open the lock we would (starting at 0) rotate clockwise 10 ticks to reach the combination value of 30, then rotate counterclockwise 20 ticks to reach 10, then rotate clockwise 35 ticks to reach value 15. Make sure you agree before moving on FORTRESS Assignment 1. Ask the user to input three integers, one per line, for the three numbers in the lock's unlock sequence 2. Ask the user to enter the number of ticks to turn the lock clockwise 3. Ask the user to enter the number of ticks to turn the lock counterclockwise 4. Ask the user to enter the number of ticks to turn the lock clockwise 5. Determine if the user's three selections caused the lock to turn to the three combination values in the unlock sequence: (a) If yes, then print a congratulatory message and offer them an amazing prize (b) If no, print a message. Reset the lock to position 0 and make the user enter the three turns again (do not ask for a new unlock sequence [step 1]). To be clear, the program continues indefinitely until the user makes the correct sequence of turns

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

Optimization And Data Science Trends And Applications 5th Airoyoung Workshop And Airo Phd School 2021 Joint Event

Authors: Adriano Masone ,Veronica Dal Sasso ,Valentina Morandi

1st Edition

3030862887, 978-3030862886

More Books

Students also viewed these Databases questions

Question

What is an interface? What keyword is used to define one?

Answered: 1 week ago