Hacking a Safe Lock after 3 tries

My friend has a safe lock, with a numeric password of 4 digits (varying between 0-9 each). She lost the password and looked for my help. Fortunately, I was able to hack it. I could try some different combinations and check how many numbers I got right.

I tried the number 8086 => Only 1 number is right, but in the wrong position.

I tried the number 8857 => Only 1 number is right, but in the wrong position.

I tried the number 0159 => I got 3 numbers right, all in the correct position.

And then the hack stopped working. If I insert just one wrong number, the safe lock will break.

Am I able to open this lock with the information provided by my hack? If so, what is the password?

I think the correct password is

0179

Reasoning

Combining the second and third clues tells us that '5' is not in the combination, otherwise it would be in the correct position in the second combination. Therefore, 0, 1, and 9 are all in the correct position in the last combination. The first clue tells us that the third digit is not 8. Using the second clue again, the only remaining option is 7.

• Ah, sniped! Well done!
– Matt
Mar 15, 2019 at 16:21
• Seconds away from beating you! Mar 15, 2019 at 16:21
• Well done!! Got me too! Mar 15, 2019 at 16:22