Answered step by step
Verified Expert Solution
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
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 turnsStep 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