How to know the correct translation-I'm in a Spanish class and we are supposed to translate sentences in their correct way. My question is, how do I know if I am supposed to translate a sentence in Preterite or in imperfect.

For example, how do I know if " Carlos tried to open the door, but it was locked." is preterite or imperfect?