1.Did you lock the door before you left the house?
(because "before you left the house" is a specific time, and we never use PP for specific times)
2.He lived in London for 2 years and then he went to Edinburgh.
(I think there's an error in this question. The first tense MUST be PS. Again, "then" refers to specific time, so no PP)
3.I have written the letter,but I can't still find a stamp.
(present perfect, because "written the letter" is closely related to the present stituation ("can't find a stamp"))
Overall, remember PP differs from PS because there's a strong link to the present. If you're just talking about the past, PS is better. Also remember that PP is never used with a specific time like "at 3:00", "when I saw you", "after I finished lunch", etc.
Hope this helps!