The only formula we learned for work is $W=\int pdV$. In stage 2 of Carnot cycle, there is no heat transfer but the volume increases, pressure decreases, internal energy decreases and temperature too. So even if we plug ideal gas equation, the integral is not solvable because the temperature is changing (we didn't learn what function describes that to plug into the integral).
I have only learned thermodynamics, no heat transfer.