Implement the Black-Scholes closed-form formulas to price a European call or put option. You are given six inputs: current stock price S, strike price K, annualized volatility σ (as a decimal), continuously-compounded risk-free rate r, continuously-compounded dividend yield q, and time to expiration T (in years). First compute the two intermediate quantities
d₁ = [ln(S/K) + (r – q + ½σ²)T] / (σ√T) d₂ = d₁ – σ√T
Then return the option price using the standard Black-Scholes formulas
Call price C = S e^{-qT} N(d₁) – K e^{-rT} N(d₂) Put price P = K e^{-rT} N(–d₂) – S e^{-qT} N(–d₁)
where N(·) is the cumulative distribution function of the standard normal distribution. Your function should accept the six parameters plus an indicator “call”/”put” and return the corresponding option price. Round the final price to four decimal places.