How do you print superscript in Python?

You need to use a ‘format’ type thing. Use {}\u00b2".format(area))" and the{}becomes a²`. Here is an example:

print("The area of your rectangle is {}cm\u00b2".format(area))

The end of the code will print cm². You can change the large 2 at the end to other numbers for a different result.
I do not know how to do a lower subscript though.

Leave a Comment