This is the 17th most frequent Spanish word.
pero
"But."
Here, 'pero' presents a contrast between the difficulty of the exam and the positive outcome achieved through effort.
El examen fue difícil, pero estudiando pude aprobarlo.
The exam was difficult, but by studying I was able to pass it.
Here, 'pero' is used as a conjunction introducing a contrast.
Me gusta ese vestido, pero creo que es muy caro.
I like that dress, but I think it's very expensive.
In this case, 'pero' is connecting two phrases, with the second providing an obstacle or reason for the inability to act on the first.