input: Write a python function to find the root of a function using the bisection method.
  assert bisection(lambda x: x**2 - 4, 0, 3, 0.01) == 2.0
  assert bisection(lambda x: x**2 - 9, 2, 5, 0.01) == 3.0
  assert bisection(lambda x: x**3 - 1, 0, 2, 0.01) == 1.0
output: def bisection(f, a, b, tol):
      if f(a) * f(b) >= 0:
          return None  # The function must have different signs at a and b
      
      while (b - a) / 2.0 > tol:
          midpoint = (a + b) / 2.0
          if f(midpoint) == 0:
              return midpoint
          elif f(a) * f(midpoint) < 0:
              b = midpoint
          else:
              a = midpoint
      
      return (a + b) / 2.0