# Python Basics : Part 1 – Arithmetic

Python and R are the two widely used programming languages for data science. I am going to start with some basic python coding on the jupyter notebook which should help us better understand how tough or easy it is to code.

Python has two basic number types : Integer and floating point. So pretty much any arithmetic function can be done in python on these data types. Here are some examples to get started with :

You can try these out on your local session of jupyter notebook

```In  : 1+1
Out : 2```

Subtraction –

```In  : 1-1
Out : 0```

Multiplication –

```In  : 2*2
Out : 4```

Division –

```In  : 1/2
Out : 0```

Note that 1/2 in Python 2.7 will throw 0 as the output where as Python 3.6 will throw 0.5 as the output. Python 2.7 expects the denominator to be present in floating point format for the correct results.

```In  : 1/2.0
Out : 0.5```

Exponent –

```In : 2**4
Out: 16```

Modulus –

```In : 4%2
Out: 0```

The modulus function helps identifying if the number is even or odd based on the output. MOD the input number by 2 and if the output is 0 then the input number is even else its odd.

```In : 5%2
Out: 1```

You can try out more of such arithmetic operations and let me know in the comments sections below. Let’s now move on to the topic of variable assignments in python.