Asterisk Multiplication

• Double asterisk (**): Exponentiation (x to the power ofy)

Tip Some of these operators also work on data types other than numbers, but they may work differently. For example, + adds two numbers (2 + 2 gives the result 4), but it concatenates strings ('2' + '2' gives the result '22'). You can't use an operator with two incompatible data types. For example, if you try to use + with an integer and a string, Python returns an error.

We discuss arithmetic operators in greater detail in Chapter 7.

Was this article helpful?

0 0

Post a comment