Ask Your Question

Revision history [back]

Something like this:

x = [i^2 for i in range(20)]  # for testing purposes
for i in range(1, 11):
    show(LatexExpr(fr"\text{{The variable }} x_{{{i}}} \text{{ takes the value :}}"), x[i])

Something like this:

x = [i^2 for i in range(20)]  # for testing purposes
for i in range(1, 11):
    show(LatexExpr(fr"\text{{The variable }} x_{{{i}}} \text{{ takes the value :}}"), :}}"),
         x[i])

Python formatted strings or f-strings can include things in {}.

Escaping that inclusion mechanism to get actual braces is done using {{}}.