In [ ]:
class Polinomio:
    def __init__(self, coefs):
        self.coefs = coefs

In [ ]:
p = Polinomio([+3, +2, +9])
p

In [ ]:
class Polinomio:
    def __init__(self, coefs):
        self.coefs = coefs
        
    def _repr_latex_(self):
        out = ""        
        for i,c in enumerate(self.coefs[::-1]):
            out = out + "{0:+d}x^{1}" .format(c,i)
        return "${0}$".format(out)

In [ ]:
p = Polinomio([+3, +2, +9])
p

In [ ]:
class Tabela:
    
    def __init__(self):
        self.s = """<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>"""
    def _repr_html_(self):
        return self.s
    
table = Tabela()
table