This can be done with the jupyprint package: https://pypi.org/project/jupyprint/
To print "live" variables in LaTeX/markdown, you can use something like the following code:
import jupyprint as jp
x=1
y=0
n=10
jp.jupyprint(f"$ {complex(x, y)}" + " ^ \\frac{" + f"{1}" + "}{" + f"{n}" + "} $")
There is a full demo here: https://github.com/pxr687/jupyprint/blob/main/jupyprint_demo.ipynb