Skip to content
Advertisement

Superscripting a string in python

Hello I am trying to superscript a string for a plot.

JavaScript

And the result i get is:

enter image description here

The “-0,2*x” should be superscripted. What am I doing wrong? Thank you!

Advertisement

Answer

It IS making the - a superscript. To get the whole expression in there, you need to enclose the whole expression in curly braces. Since you have this in an f-string, where curly braces have meaning, that means you need these rather awkward triple-braces

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement