Holla Tech - Learn

Exponentiation
 

Besides addition, subtraction, multiplication, and division, Python also supports exponentiation, which is the raising of one number to the power of another. This operation is performed using two asterisks. 

>> 2**5
32
>>> 9 ** (1/2)
3.0 

 

NOTE!
You can chain exponentiations together. In other words, you can rise a number to multiple powers. For example, 2 3 2.

Quotient & Remainder
 

To determine the quotient and remainder of a division, use the floor division and modulo operators, respectively.
Floor division is done using two forward slashes.
The modulo operator is carried out with a percent symbol (%).
These operators can be used with both floats and integers.

This code shows that 6 goes into 20 three times, and the remainder when 1.25 is divided by 0.5 is 0.25.

>> 20 // 6
3
>>> 1.25 % 0.5
0.25 

 

NOTE!
You can chain exponentiations together. In other words, you can rise a number to multiple powers. For example, 2 3 2.

BACK NEXT

CLICK ON THE BUTTON BELOW TO GO TO THE PYTHON MAIN COURSE PAGE. 

PYTHON MAIN COURSE PAGE

 


©️ License: All Rights Reserved 


CONTACT HOLLA TECH – LEARN SUPPORT