Lets start our first lesson in Python. Python makes calculations easy. Let’s check it out.

First check if IDLE icon is present on your Desktop. If not, click on the Windows Button and type IDLE in the search bar at the bottom of the screen. Right click at IDLE and select open file location. Copy Paste the IDLE (Python 3.6 64-bit) shortcut onto your Desktop.

Now that IDLE is on your Desktop,lets get started.Double click the IDLE icon. The Python 3.6.3 shell appears that looks like this. Lets try simple calculations.Enter these commands and press enter.

- So here we use +,-,*,/ for addition,subtraction,multiplication and division respectively.
- ** is used for exponent operations.
- ‘ % ‘ is the modulus operator which gives the remainder of division of 2 numbers.
- The integer numbers (e.g. 8, 1) have type int, the ones with a fractional part (e.g. 7.5,6.2) have type float.
- Python follows a particular precedence of operation which is as follows: Brackets>Exponent>Division/Multiplication(from left to right)>Subtraction/Addition(from left to right).
- Division (/) always returns a float.
- To do floor division and get an integer result (discarding any fractional result) you can use the // operator.

>>> 4/3

1.3333333333333333

>>> 4//3

1

- In interactive mode, the last printed expression is assigned to the variable _.

>>> 4//3

1

>>> 5+_

6

- round(number,places) is used to round a floating point number to required decimal places.

>>> round(56.668,1)

56.7

Printing numbers in Python

- The variable must be enclosed in a parenthesis while printing.

>> a=7

>>> print (a)

7

In a later tutorial, you will learn how to combine strings and numbers.

## Leave a Reply