input: Write a function to create a class in Python to represent a complex number. The class should include an initialization method to set the real and imaginary parts and a method to return the complex number as a string in the form "({real} + {imaginary}i)". If the imaginary part is negative, the string should be formatted as "({real} - {imaginary}i)".
  
  class ComplexNumber:
      def __init__(self, real, imaginary):
          self.real = real
          self.imaginary = imaginary
  
      def __str__(self):
          if self.imaginary < 0:
              return "({0} - {1}i)".format(self.real, -self.imaginary)
          else:
              return "({0} + {1}i)".format(self.real, self.imaginary)
  
  assert str(ComplexNumber(1, 2))=="(1 + 2i)"
  assert str(ComplexNumber(3, -4))=="(3 - 4i)"
  assert str(ComplexNumber(-5, 6))=="(-5 + 6i)"
  assert str(ComplexNumber(7, 0))=="(7 + 0i)"
  assert str(ComplexNumber(0, -8))=="(0 - 8i)"
output: class ComplexNumber:
      def __init__(self, real, imaginary):
          self.real = real
          self.imaginary = imaginary
  
      def __str__(self):
          if self.imaginary < 0:
              return "({0} - {1}i)".format(self.real, -self.imaginary)
          else:
              return "({0} + {1}i)".format(self.real, self.imaginary)