Exercise:03 Introduction to python
Python as a calculator
Python is perfectly suited to do basic calculations. Apart from addition, subtraction, multiplication, and division, there is also support for more advanced operations such as:
- Exponentiation:
**. This operator raises the number to its left to the power of the number to its right. For example4**2will give16. - Modulo:
%. This operator returns the remainder of the division of the number to the left by the number on its right. For example18 % 7equals4.
The code in the script gives some examples.
Comments
Post a Comment