"I lived for two years in Mexico."
Translation:Yo viví dos años en México.
I believe you would only include the 'por' if you changed the order of the sentence:
Yo viví dos años en México. = I lived for two years in Mexico.
Viví en México por dos años. = I lived in Mexico for two years.
Notice in the first example the 'por' isn't used. I do not believe you need it immediately after the verb in Spanish. Unlike the English where we use it in both. I'm not sure if including it would be incorrect. I'm leaning towards yes on that simply because the verb itself doesn't require it. I would love a second opinion here.
Preterite is for something you talk about that has been completed while imperfect is referring to something you were in the process of doing So for "I was cooking breakfast yesterday when I stubbed my toe", cooking is imperfect while stubbed is preterite. In this case, you are not talking about when you were living there, but that you already did, so it's in the preterite (viví)
I still don't know why this sentence leaves out "for", however, here are some tips I learned: Use 'para' for Deadlines, Destinations, Goals, and Recipients or “in order to”. Note: deadlines and goals can be expressed as time. Example: I need oranges for tonight- necesito naranjas para la noche
Use 'por' for Time Duration, Communication, Exchanges, Motivation, and Travel or “on behalf of”. Example: We are staying in Boston for two months- Nos quedamos en Boston por dos meses. Note that por is also used when an exhange is made. Example: "Ella pagó un buen precio por esa falda." Translation: She paid a good price for that skirt (money exchanged for skirt). Hope this helps.
You usually don't use articles in front of names. There's a couple exceptions. If referring to a person in the formal (talking about not to) then the article is used. For example, "El señor Pérez quiero agua." Another exception would be if you are saying something along the lines of the forest of the king (el bosque del rey).