Implementing Black-Scholes Option Pricing

The Black-Scholes formula is the most commonly used financial model used for pricing options. Below we have two tutorials for implementing the Black-Scholes model in both Excel & Python. 

def blackScholes(r, S, K, T, sigma, type="c"):
    "Calculate BS price of call/put"
    d1 = (np.log(S/K) + (r + sigma**2/2)*T)/(sigma*np.sqrt(T))
    d2 = d1 - sigma*np.sqrt(T)
        if type == "c":
            price = S*norm.cdf(d1, 0, 1) - K*np.exp(-r*T)*norm.cdf(d2, 0, 1)
        elif type == "p":
            price = K*np.exp(-r*T)*norm.cdf(-d2, 0, 1) - S*norm.cdf(-d1, 0, 1)
        return price
        print("Please confirm option type, either 'c' for Call or 'p' for Put!")

Even in today’s age when everyone wants to be a ‘wizz kid’ who can program, we cannot ignore the power and simplicity of Excel as the backbone of the Financial Industry. 

Excel is a great resource, however I find when the problems I am trying to solve get more complicated, or more iterations or processing is required, Python is a more effective tool for such cases as a simple scripting language.