Does light have a mass? Could you please argue with work and gravity? Or however you like. I just don't get it. Thanks.
A physics professor talked about if light had a mass, it should do work ($W=N\cdot m = \frac{kg\cdot m}{s^2}\cdot m$) to get out of the gravitational field. But because we somehow can see it doesn't, light doesn't have a mass.
 A: Does light have a rest mass? No, the rest mass of a photon is zero. Is light affected by gravitational fields? Yes, because it has energy. In particular, light moving against a gravitation field does work and loses energy - we can see this because the light is red-shifted.
A: Final edit. If it is the first time you read this go to the bottom, where I have summarized the arguments about classical electromagnetism modeling light, and mass in special relativity, replying to the title.
Here once again is an example of how light is an emergent phenomenon from single photons. This is a double slit experiment one photon at a time:


Single-photon camera recording of photons from a double slit illuminated by very weak laser light. Left to right: single frame, superposition of 200, 1’000, and 500’000 frames.

An individual photon has mass zero, this means its four vector $(p_x,p_y,p_z,E)$ has a "length" of zero.
Can two photons added together have a mass larger than zero? Sure, unless they are collinear, the added four vectors will have an invariant mass. A good example is the pi0 particle which decays into two photons.
In the experiment above, the photons that make up the light that  gives the interference pattern on the right, are not colinear, they have different momentum directions. Thus the addition of the four-vectors of the photons will have a mass, by construction of special  relativity.
The numbers entering in the summation are such that for optical frequencies and in general frequencies smaller than X-rays it can be assumed to be zero  within errors.
Further thoughts on the classical light emerging from photons:
Mass is not a conserved quantity in special relativity, only energy and momentum. That two photons that are not collinear have an invariant mass, does not mean that when extra photons are added the invariant mass cannot be smaller, by more photons cancelling the non co-linear part.
A beam of light by construction has a fixed direction, about which the photons are statistically distributed. This means that at a given $t$
the non collinear part of the momenta of the photons about the beam direction will statistically cancel; the momenta and the four vectors of the zillions of photons will  add up to a four vector of a zero mass with a very small  deviation from zero mass. This deviation will be due at specific time  $t$ to the statistical excess on one side of the photons composing the beam.
This is an interesting study of this effect with pulses of light.

The concept of the Lorentz-invariant mass of groups of photons is shown to be  applicable to classical light pulses with finite sizes and duration. Diffraction of light, providing non-collinearity of the photon motion in pulses, provides also nonzero values of their Lorentz-invariant masse

Here is a more recent article on the same lines.
In General Relativity,GR, which at the level of small masses and velocities reduces to Newtonian physics, if there is  no mass or energy in space , the space-time is flat. The mathematics to use are the four vectors, and light, as it has energy , has a four vector associated with it.
Every four vector obeys the Einstein relativistic equation of GR, and light and photons do also. That is why there is gravitational lensing, light bending passing close to stars. The statement of your professor holds only for areas where gravity is small as the earth environment . Do not forget that Newtonian mechanics reproduces almost perfectly the motion of the planets, sowing that GR has a small higher order effect.
Summary about mass and light.
What follows is an exposition within the mainstream model of light at present.
Special relativity (SR) is expected to be valid in all physics modeling, and all matter is represented by SR four vectors $(p_x,p_y,p_z,E)$. Mass is the "length" of the four vector.
Special relativity reduces to Galilean at small velocities . For small velocities special relativity  effects are too tiny to be measured, thus  for Galilean relativity mass is a conserved quantity.
Thus mass is not an additive quantity and is not a conserved one. In special relativity what is conserved is energy and momentum and matter bodies have the mass given by the total four vector describing them, the "length" of it.
Classical electromagnetic radiation obeys Lorentz transformations and has the limit of  velocity $c$.  It can be demonstrated in special relativity that it is impossible for massive particles to move with velocity c, thus a classical electromagnetic wave solution of the Maxwell equations has to have mass zero.
Classical electromagnetic light has been shown to be composed out of photons, which are elementary particles of zero mass (see pictures above). The four vector addition of photons does not mean that when added their zero masses add up to zero. This only happens when they are collinear. Thus it means that the solutions of Maxwell's equations for light  are absolutely correct ( in describing light)  and have mass of zero only when the photons composing it, seen in the particle frame, have a total four vector adding up to zero, the collinear case.
Then the statistical argument can be used. Beams of light have a photon distribution symmetric about the axis of the beam, and thus the momenta of the four vectors cancel statistically, and thus the collective beam mass is zero, except for small statistical dispersion at a given time.
Non collinear packets are expected to have a nonzero mass, (which  will be very small for frequencies below X-ray)
The answer to the title: "Does light have a mass?" is
It has mass zero, if it can be modeled by an exact solution of Maxwell's equation, zero within tiny statistical errors for directional  incoherent beams, and a [tiny mass is expected6 in measuring   non collinear pulses.
A: Mass is defined in relativity by $m^2=E^2-p^2$, where $E$ is the mass-energy and $c=1$. A ray of light or an EM plane wave has zero mass. However, mass is not additive, and a collection of light rays, or a more complicated wave pattern can have nonzero mass.
It's not really correct to argue about whether light has mass based on gravitational effects as it emerges from a gravitational field. General relativity doesn't describe gravity as an interaction involving mass or mass-energy, it describes it as an interaction involving the stress-energy tensor. For example, parallel pencil beams of light happen to have zero gravitational interaction with each other according to GR, but we don't conclude from that that a pencil beam of light has no mass or no mass-energy. Such a beam will interact gravitationally with other things.
The answer by anna v is conceptually confused. None of this has anything to do with quantum mechanics or wave-particle duality.
Even in the context of newtonian gravity, it doesn't really make sense to talk about a projectile doing work to escape from a gravity well. Work is done on the projectile. The projectile's force on the planet does zero work in the rest frame of the planet.
