**
characterPython uses the **
characters to "make" exponents. For example:
^
character for nowThe ^
character doesn't give you an exponent in Python; instead, it's an exclusive or, which we'll talk about later.
This **
/^
distinction might strike you as a bit odd. Unfortunately, when Python was being invented, the ^
character was already being used for exclusive or, so the person writing Python needed to come up with something else. He seems to have chosen two stars (**
) because exponents are a bit like "super multiplication."
You can ask Python to help you calculate exponents that include negative numbers and decimals, too:
What's the result of these exponent problems? (Use the console below, if you like!)
2 ** 6
1 ** 8
3 ** 2
3 ** -3
16 ** 0.5
16 ** (1/2) # Does this one surprise you?
16 ** 1/2 # What about this one?