If photon energies are continuous and atomic energy levels are discrete, how can atoms absorb photons? If photon energies are continuous and atomic energy levels are discrete, how can atoms absorb photons? The probability of a photon having just the right amount of energy for an atomic transition is $0$.
 A: That's a really good question!
There are three cases, the third of which is the most fundamental and most interesting.
The first case is incomplete absorption, such as a gamma ray knocking loose a few electrons as it passes. In that case the differences are taken care of locally and fairly trivially by allocating energy, momentum and spin appropriately between the parts that were hit and the remaining photon.
The second case is flexible absorption, which is when the target receptor is sufficiently large and complex to absorb whatever the difference is between the light that was emitted and atomic-level receptors of the target. A good example of this kind of flexible absorption is the opsin proteins in the retina of your eye. These proteins are sufficiently large and complex that, like pitcher's mitts in baseball, the molecule as a whole can absorb the mismatches energy, momentum, and spin of any photon that falls within a certain rather broad range of frequencies and polarizations. So, it is some variant of this category that takes care of the flexibility needed in most forms of photon absorption.
The third case and most curious case happens when you start looking at the quantum side of the question.
Because of quantum mechanics, no photon has a truly exact location, energy, momentum, or polarization (or spin, basically its angular momentum). A photon that has traveled for a long time through interstellar space, for example, does pretty well on the precision of its frequency (energy and momentum), but is frankly all over the place in terms of where it could wind up in space. Nonetheless, it still has some residual uncertainty in its frequency, even after a long trip.
As with the local flexibility of receptors such as the opsins, this bit of quantum frequency uncertainty also allows some leeway in whether or not a photon will be absorbed by an electron in an atom. The wave function description of the photon in that case allows it to behave like any of a small number of close but distinct frequencies, one of which will be selected when it arrives even at a flexible receptor such as an opsin.
However, this final form of flexibility is a bit strange. If energy (which is the same as its frequency for a photon in space) is absolutely conserved, isn't this bit of ambiguity in how the photon is "registered" with an opsin protein in your eye going to cause a slight deviation somewhere in the total energy of the universe? For example, what if the original atom that emitted the photon ended up in its energy accounting books as having emitted the emitted the photon at the lower end of the likely envelope, but the atoms in your opsin protein interpreted it as having energy in the upper end of that envelope? If that happens, hasn't your eye in that case just created a tiny bit of energy that did not exist in the universe as a whole before, and so violated energy conservation by just a tiny bit?
The answer is intriguing and not at all understandable from a classical viewpoint.
While quantum uncertainty does allow certain degree of freedom that makes absorption possible over a range of frequencies, it does so at a cost to our usual concepts of locality. Specifically, every such event "entangles" the emission and absorption of the photon into single quantum event, no matter how separated the events may appear to be in ordinary clock time.
When I say "entangle" I mean the word in exactly the same somewhat mysterious way it is used by people describing quantum computation. Entanglement is a bit of physics that crosses ordinary boundaries of space and time in very odd ways, but some aspect of it is always involved in quantum events.
How odd? Well, if you live in the Northern hemisphere try this some night: Figure out where the Andromeda Galaxy is, and go out and look at it. So: did you see it?
If so, you just ensured that the frequencies (energies) of every photon you saw is now exactly balanced in the unforgiving conservation books of the universe with the formerly uncertain energies of photon emission events that took place roughly 2.5 million years ago. This balancing in a quite real sense did not occur until you took a look at the Andromeda galaxy and forced those photons to give up their former uncertainty. That's how all entanglement works: The wave function remains open and uncertain until a firm detection occurs, then suddenly and frankly rather magically, everything balances out.
And all this time you thought there was nothing particularly strange about ordinary light-based vision, yes?
Notice, however, that this third entanglement-enabled form of photon reception flexibility only works within the constraints of the photon's wave function.
That observation suggests an experiment that is closely related to your original question, which is this: If you could make the wave function of the photon so tightly and narrowly defined that the slop enabled by entanglement no longer applies? Would your question about "zero probability" then apply, at least at the limit of a wave function with no uncertainty at all in it?
The answer is yes.
As it turns out, you can approximate that "no ambiguity left" limit in photon wave functions simply by increasing the energy of the photon. In particular, when you get up into the range of gamma photons, exact, "kick-free" absorption (versus emission) of a photon starts becoming a rare event indeed.
This specificity of gamma photons can be demonstrated experimentally by using something called the Mössbauer effect, which is itself a beautiful and decidedly strange example of quantum effects impinging on everyday large-scale life. In Mössbauer, groups of atoms within ordinary chunks of elements at room temperature behave as if they were completely motionless. (How they do that is beyond the scope of this question, but it has to do with a novel form of Bose-Einstein condensation within the vibration modes of the atoms.)
The Mössbauer effect allows your question to be explored experimentally in an ordinary lab. One group of "motionless" gamma emitting atoms sends gamma rays to another "motionless" group of atoms that can absorb exactly that frequency of gamma photons. Next, you try messing with the frequencies of the gamma photons every so slightly by putting one of the groups of atoms into linear motion relative to the other one.
The question then becomes this: How fast do you have to move one of the groups of atoms (which one doesn't matter) before the receiving group can no longer "see" the frequencies and absorb the gamma photons?
You might think that you'd have to go thousands of miles per hour to have such a profound effect on something as energetic as gamma rays, but it's the other way around! Even a tiny, tiny velocity of a centimeter or so per second is enough to cause a big drop in the level of absorption of the gamma photons.
And that is why your question really is an interesting one: Because you are right. While it takes some work to set it up and some pretty unusual effects to test it, in the end it really is vanishingly unlikely to get an exact match between the frequency emitted by one atom (or nucleus of an atom) and the frequency expectations of the absorbing atom. It is only through three compensating factors -- incomplete absorption, locally forgiving absorption, and quantum entanglement -- that you get the high levels of "practical" photon absorption that make the world as we know it possible.
A: Though some atomic levels can be theoretically discrete (for example, the ground states), the frequencies of atomic transitions are defined by the difference of two atomic levels and are not discrete, the relevant bands have finite width (so called natural line width). Furthermore, there is Doppler broadening, collisional broadening of the band, and so on. So the probability of photon absorption can be finite.   
A: In quantum mechanics there is also uncertainty principle. For energy ($\Delta E\cdot\Delta t \ge \hbar/2$) it means that the linewidth ($\Delta E$) is inverse proportional to timelife ($\Delta t$) of the state. If the timelife is finite, the linewidth is finite also. Thus, no zeroes.
A: Here is an experimentalist's answer:
You state:

The probability of a photon having just the right amount of energy for an atomic transition is 0.

You must be aware that the statement falls just by the existence of lasers, so your question should have a how is it possible to have lasers.
1) An individual photon cannot be labeled as continuous. It has a specific frequency nu, and energy E=h*nu. It is the photon frequency spectrum that may be continuous. There can be millions of photons at a specific nu, where a delta(nu) as accuracy of measurement is inevitable.
2)Atomic levels  have a mesurable width. It is the reason that what can be emitted can be absorbed as seen below.


continuous spectrum



emission lines



absorption lines

Thus your question comes down to why do atomic orbits have a width, which is a different question.
There are several reasons for the width of the lines:

• 3 mechanisms determine profile φ(ν)
– Quantum mechanical uncertainty in
  the energy E of levels with finite
  lifetimes. --> the natural width of a line
  (generally very small).
– Collisional broadening. Collisions
  reduce the effective lifetime of a state,
  leading to broader lines.High pressure
  -> more collisions (eg stars).
– Doppler or thermal broadening, due to
  the thermal (or large-scale turbulent)
  motion of individual atoms in the gas
  relative to the observer.

The analysis in the lecture.
A: This is a very good question.
As Ben Crowell says, the photon life-time is finite and so its energy is spread by a range of frequencies, i.e. it's not a delta-function over a specific frequency.
The photon's energy can be obtained integrating over all the spectrum and might be the one corresponding to the peak,  E= h•f where f is the frequency where there is the peak.
Anyway, in this case should we assign the frequency "f" to this photon and expect that when it's absorbed it will transfer h•f eV to the absorber electorn?
Another question is how the wave packet is in the space since it has to respect Maxwell equations and therefore you cannot place a square window with N periods and left it happily... Gaussian beams may be good candidates...
I am sorry if I cannot be more accurate about this very interesting matter and I also apologize by my English.
