Fresnel equation with incident angle, n and k as input
@PaulHK's answer is correct I'm sure, here's a bit of a check to show that the IOR() function is calculating the reflection coefficients for $s$ and $p$ polarizations then averaging the two assuming unpolarized incident light.

The reflection is for a single interface, and at least at normal incidence the results reduce to the simpler $(n_2-n_1)^2/(n_2+n_1)^2$. With this script you can check against other on-line calculators using non-zero incident angle and nonzero values for $k$.

I cleaned up the python a bit (indents) and added the plot. You can see when exiting from glass to air, the reflectivity goes to 100% at the critical angle for total internal reflection:





def IOR(n,k):
    theta_deg = 0

    fresnel = []

    while theta_deg &lt;= 90:
        theta = math.radians(theta_deg)

        a = math.sqrt((math.sqrt((n**2-k**2-(math.sin(theta))**2)**2 +
                                 ((4 * n**2) * k**2)) + (n**2 - k**2 -
                                            (math.sin(theta))**2))/2)

        b = math.sqrt((math.sqrt((n**2-k**2-(math.sin(theta))**2)**2 +
                                 ((4 * n**2) * k**2)) - (n**2 - k**2 -
                                            (math.sin(theta))**2))/2)

        Fs = (a**2+b**2-(2 * a * math.cos(theta))+
              (math.cos(theta))**2)/(a**2+b**2 +
                            (2 * a * math.cos(theta))+(math.cos(theta))**2)

        Fp = Fs * ((a**2+b**2 -
                    (2 * a * math.sin(theta) * math.tan(theta)) +
                    (math.sin(theta))**2*(math.tan(theta))**2)/(a**2+b**2 +
                    (2 * a * math.sin(theta) * math.tan(theta)) +
                    (math.sin(theta))**2*(math.tan(theta))**2))

        R = (Fs + Fp)/2

        fresnel.append((R, Fs, Fp))

        theta_deg += 1
    return fresnel

import math
import matplotlib.pyplot as plt

n1, n2  = 1.00, 1.45  # into glass, one side only
n2ovrn1 = n2/n1

Rin, Fsin, Fpin = zip(*IOR(n2ovrn1, 0))

print Rin[0]
print (n2ovrn1-1.0)**2 / (n2ovrn1+1.0)**2  # check

n1, n2  = 1.45, 1.00  # outof glass, one side only
n2ovrn1 = n2/n1

Rout, Fsout, Fpout = zip(*IOR(n2ovrn1, 0))

print Rout[0]
print (n2ovrn1-1.0)**2 / (n2ovrn1+1.0)**2  # check

plt.figure()
plt.plot(range(91), Rin, '-k', linewidth=2)
plt.plot(range(91), Rout, '-k', linewidth=2)
plt.plot(range(91), Fsin, '-k')
plt.plot(range(91), Fsout, '-k')
plt.plot(range(91), Fpin, '--k')
plt.plot(range(91), Fpout, '--k')
plt.show()