Learning Scientific Programming with Python (2nd edition)

P8.1.3: Wavelength from molar dissociation energy

Question P8.1.3

Write a function, get_wv, which takes a molar bond dissociation energy, D0, in $\mathrm{kJ\,mol^{-1}}$ and returns the wavelength of a photon corresponding to that energy per molecule, in nm. The energy of a photon with wavelength $\lambda$ is $E=hc/\lambda$.

For example,

In [x]: get_wv(497)
Out[x]: 240.69731528286377