The energy of the photon is given by:
\[
E_{\text{photon}} = \frac{hc}{\lambda}
\]
Substitute \( \lambda = 400 \, \text{nm} \), \( hc = 1240 \, \text{eV} \cdot \text{nm} \) to find the photon energy. Then use the photoelectric equation:
\[
E_{\text{photon}} = E_{\text{kinetic}} + \text{Work function}
\]
Solving gives the work function as 1.51 eV.
Final Answer:
\[
\boxed{1.51 \, \text{eV}}
\]