Code Coach Solutions
Safety Deposit Boxes[Pro]
Difficulty: Medium
Problem Statement:
You are robbing a bank, but you’re not taking everything. You are looking for a specific item in the safety deposit boxes and you are going to drill into each one in order to find your item. Once you find your item you can make your escape, but how long will it take you to get to that item?
Task:
Determine the amount of time it will take you to find the item you are looking for if it takes you 5 minutes to drill into each box.
Input Format:
A string that represents the items in each box that will be drilled in order (items are separated by a comma), and secondly, a string of which item you are looking for.
Output Format:
An integer of the amount of time it will take for you to find your item.
Sample Input:
'gold,diamonds,documents,Declaration of Independence,keys'
'Declaration of Independence'
Sample Output:
20
Explanation:
It will take you 20 minutes before you drill into the 4th box, which contains your item, the Declaration of Independence.
Solution:
items=input().split(',')
w_item=input()
print((items.index(w_item)+1)*5)
Explanation:
The Main Objective of this problem is to find the total time taken to find the given item from the list of items. To solve this, find the index of the given item in the list and multiply it by 5. Make sure the index starts from 0, so I have taken index+1.
Result:
Hope You understand the solution. The more you practice more you Learn. If there are any queries let us know in the comment section.
Tips to solve a problem in less time:
1. Don't read the whole problem statement initially. First, go through the input and output.
2. Mostly you will understand the problem while reading input, output, and Output explanation.
3. Now, Divide your Logic into 3 steps:
step1: Input & output
check whether you have written the correct syntax for input. To check you have to print the input.
step2: Build your own logic with proper indentation.
step3: Print the expected output.
Thank you!
step3: Print the expected output.


0 Comments