Consider the following cyclic process carried out in two steps on a gas.

Step 1: 48 J of heat is added to the gas, and 20. J of expansion work is performed.
Step 2: 70. J of heat is removed from the gas as the gas is compressed back to the initial state.
Calculate the work for the gas compression in Step 2.

Can't you use

delta E = q + w
Step 1 gives q and w which allows you to calcualte delta E.
Step 2. Use that delta E, the problem provides q and w is calculated.
Check my thinking.

To calculate the work for the gas compression in Step 2, you can use the first law of thermodynamics, which states that the change in internal energy of a system is equal to the heat added to the system minus the work done by the system:

ΔU = Q - W

where ΔU is the change in internal energy, Q is the heat added to the system, and W is the work done by the system.

In Step 1, 48 J of heat is added to the gas, and 20 J of expansion work is performed. This means that the change in internal energy in Step 1 is:

ΔU1 = Q1 - W1 = 48 J - 20 J = 28 J

Since the process is cyclic, the change in internal energy over the entire cycle is zero. Therefore, the change in internal energy in Step 2 must be equal in magnitude but opposite in sign to the change in internal energy in Step 1:

ΔU2 = -ΔU1 = -28 J

In Step 2, 70 J of heat is removed from the gas as the gas is compressed back to the initial state. Therefore, the work done by the gas in Step 2 can be calculated as:

W2 = Q2 - ΔU2 = 70 J - (-28 J) = 70 J + 28 J = 98 J

So the work for the gas compression in Step 2 is 98 J.