A gas expands and does 82.7 J of work on the surroundings. At the same time, the gas loses 103 J of energy to the surroundings as heat. What is the change in the internal energy of the gas? would this be ΔE = q + w (-103) + (82.7) = -20.3. I get confused with the positive and negative charges.
The standardized definition of the change in internal energy $U$ for a closed thermodynamic system is
$$\Delta U = Q + W$$
where $Q$ is amount of heat transferred to the system and $W$ is work done on the system (provided that no chemical reactions occur).
Therefore, heat transferred from the surroundings to the system is assigned a positive sign in the equation, whereas heat transferred from the system to the surroundings is assigned a negative sign.
Similarly, work done by the surroundings on the system is assigned a positive sign in the equation, whereas work done by the system on the surroundings is assigned a negative sign.
(Note that some books on physics or engineering still use a non-standard definition when discussing the work done by a thermodynamic heat engine.)