input: Write a python function to calculate the Black-Scholes call and put option prices.
  assert BlackScholes(100, 100, 1, 0.05, 0.2).call_price() == 10.4506
  assert BlackScholes(100, 100, 1, 0.05, 0.2).put_price() == 5.5735
  assert BlackScholes(50, 50, 0.5, 0.1, 0.3).call_price() == 5.4319
  assert BlackScholes(50, 50, 0.5, 0.1, 0.3).put_price() == 2.3446
output: import math
  from scipy.stats import norm
  
  class BlackScholes:
      def __init__(self, S, K, T, r, sigma):
          self.S = S
          self.K = K
          self.T = T
          self.r = r
          self.sigma = sigma
          self._calculate_d1_d2()
  
      def _calculate_d1_d2(self):
          self.d1 = (math.log(self.S / self.K) + (self.r + 0.5 * self.sigma ** 2) * self.T) / (self.sigma * math.sqrt(self.T))
          self.d2 = self.d1 - self.sigma * math.sqrt(self.T)
  
      def call_price(self):
          return round(self.S * norm.cdf(self.d1) - self.K * math.exp(-self.r * self.T) * norm.cdf(self.d2), 4)
  
      def put_price(self):
          return round(self.K * math.exp(-self.r * self.T) * norm.cdf(-self.d2) - self.S * norm.cdf(-self.d1), 4)