No safecracking when deaf

This is just something that annoyed me, as it should be impossible to crack a safe when there is no way for you to hear the clicking sound.

Code-wise I probably missed something. Do I have to define the is_deaf function first? And will the current structure of the if-loops lead to the intended result? Sorry for my lack of experience with coding. 
Isn't there a closing parenthesis missing?