How can I display python code as a math formula?

How can I display python code as a math formula in the console application?

Example:

 a=1
 b=1
 c=1
 y=(pow(a,2)-2*b-pow(c,2))/(3*a*b)

enter image description here

>Solution :

I believe the sympy package is what you’re looking for. It can pretty print equations in the console. You’ll want to use the the preview function to creat e.g. a PNG, which a browser can easily open or can be linked to in a HTML file— you’ll need to have LaTeX installed to do this.

Leave a Reply