In university physics textbook he says :
The internal energy of an ideal gas depends only on its temperature, not on its pressure or volume.
I know that the only contribution to the internal energy comes from the translational kinetic energy (for monatomic ideal gas) according to $$U=K_{trans}=\frac{3}{2} nKT$$
So, obviously, the internal energy $(U)$ depends only on the temperature $(T)$ and the number of moles $(n)$ of the gas. But if someone did work on the gas leading to an increase in pressure and decrease in volume, will this affect the temperature accordingly?
If no, is it because the increase in pressure cancels out with the decrease in volume, and the temperature remains costant according to $$T=\frac{1}{nR}PV$$
If yes, why did he say that the internal energy depends only on the temperature, not on the pressure or the volume ?