I’m just starting to learn python. When I ask for input from the user, can I write an exponent within that? Can I do that aside from "^2"?
Let’s say this is my code:
float(input("Gravity in m/s^2, 9.8 for Earth, 24 for Jupiter): "))
My output would be:
Gravity (in m/s^2, 9.8 for Earth, 24 for Jupiter):
But I want the "2" to look like an actual exponent. Is that possible?
>Solution :
Text strings are unicode in Python, you can use the character SUPERSCRIPT TWO directly in a string:
float(input(f"Gravity in m/s², 9.8 for Earth, 24 for Jupiter): "))