human
Write me a the Python program you requested given the following:
I am working on the file "ExercisesSolutions.ipynb".
The first task is:
This looks horrible, but is correct. To really make this look good, we need to improve the output. If we use
Can you write Python program for it?
assistant
#Here is the Python program you requested.

class Monomial(Polynomial):
    """Representing a monomial, which is a polynomial with leading term 1."""
    explanation = "I am a monomial"
    
    def __init__(self, roots):
        Polynomial.__init__(self, roots, 1)
        
    def __repr__(self):
        if len(self.roots):
            string = ""
            n_zero_roots = len(self.roots) - numpy.count_nonzero(self.roots)
            if n_zero_roots == 1:
                string = "x"
            elif n_zero_roots > 1:
                string = "x^{}".format(n_zero_roots)
        else: # Monomial degree 0.
            string = "1"
        for root in self.roots:
            if root > 0:
                string = string + "(x - {})".format(root)
            elif root < 0:
                string = string + "(x + {})".format(-root)
        return string