Ticker

6/recent/ticker-posts

Basic arithmetic operations in Python:

 Basic arithmetic operations in Python:

In this tutorial we will discuss about various basic arithmetic operations in Python. The arithmetic operators are used to perform mathematical operations. 

There are seven arithmetic operators in python. They are

Addition

Subtraction

Multiplication

Division

Modulus 

Exponentiation

Floor division

1. Addition

The addition operator in python is ‘+’. It will add or sum up two values.

Code implementation:

Addition in Python


 2. Subtraction

The subtraction operator in python is ‘-’. It will subtract two values.

Code implementation:

Subtraction in Python


 3. Multiplication:

The Multiplication operator in python is ‘*’. It will multiply two values and used to find the product of two numbers.

Code implementation:

Multiplication in Python


 4. Division:

The Division operator in python is ‘/’. It will divide two values and the result will be in floating point number.

Code implementation:

 

Division in Python

5. Modulus:

The Modulus operator in python is ‘%’. It will divide two values and the result will be the remainder.

Code implementation:

Modulus Operation in Python


 6. Exponentiation:

The Exponentiation operator in python is ‘**’. It will raise the first number to the power of second number.

Code implementation:

Exponentiation in Python


 

7. Floor division:

The Floor division operator in python is ‘//’. It will divide the two numbers and it’ll find the quotient and it’ll floor it to the nearest integer.

Code implementation:

Floor Division in Python


 



Post a Comment

0 Comments