# Print superscript characters in Python browsing

• posted
0

Hello everybody. For project that I am doing, I would need to write the acceleration formula, which is expressed in metres square two. How do I write 2 above the letter s? For it to be a number I read that it’s done with two asterisks, but the letter aren’t working.

• posted
1

@GiovaBici try

``````print(f'a\N{superscript THREE}')
``````

which gives

``````a³
``````

Sorry

``````print(f's\N{superscript TWO}')
``````

To get

``````s²
``````

• posted
0

Thank you very much. How can I integrate it in here ( forgive me ignorance but I started recently). Thank you

print("L'accellerazione é: " + str(accellerazione_finale) + " m/s**2")

• posted
0

@GiovaBici said:

print("L'accellerazione é: " + str(accellerazione_finale) + " m/s**2")

``````accellerazione_finale = 7
print(f"L'accellerazione é: {accellerazione_finale}  m/s\N{superscript TWO}")
``````

Gives

``````L'accellerazione é: 7  m/s²
``````

• posted
1

You can also add Unicode superscripts to the characters: \u00B2

Result is something like this:

``````print(''.join('m/s' + '\u00B2'))
print('m/s\u00B2')
``````

• posted
1

@7upser said:

Unicode superscripts

Still better...

• posted
1

``````accellerazione_finale = 7654
print(f"L'accellerazione é: {accellerazione_finale:,} m/s\u00B2")
``````

`L'accellerazione é: 7,654 m/s²`

• posted
0

Thank you very much for the answers !

• posted
0

Hello everyone. Can you still help me: how do I write a calculation under the square root? Thanks to who will answer me

• posted
0

I don't think there is a unicode overline that does what you want. You could try U+0305

Really, this is a job for mathml or latex.
I don't think safari supports mathml.

• posted
0

Thank you very much

• posted
0

@cvp
Hi. In this case how can I put the two above m ?:

area_pressione = float(input("Inserisci l'area(m): "))

Thanks and sorry if I still don't understand ...
I still wanted to ask: Can I have certain print commands written in a different color than black?
Thank you

• posted
0

@GiovaBici

``````area_pressione = float(input("Inserisci l'area(m\u00B2): "))

Inserisci l'area(m²):
``````

• posted
0

• posted
0

Thank you very much!

Internal error.

Oops! Looks like something went wrong!