\documentclass{article}

\usepackage{listings}
\begin{document}
\lstset{basicstyle=\small\ttfamily}
\begin{lstlisting}
A<T>:=PolynomialRing(RationalField()); 
E8:=GroupOfLieType("E8",RationalField()); 
gen:=AlgebraicGenerators(E8); 
rho:=AdjointRepresentation(E8); 
g:=Identity(E8); for i in gen do g:=g*i ; end for; 
m:=rho(g); 
pol:=CharacteristicPolynomial(m) div (T-1)^8; 
\end{lstlisting}

\end{document}

