DEV Community

Noor E Jannat Nafia

Posted on • Updated on

Arithmetic Operations - Python - Part 1

Several data types:

• number: integer, float, complex
• string
• print statement
• list
• dictionary
• boolean
• tuple
• set

NUMBER:

A number can be either an integer or a float.
An integer is a whole number.
Integer - 3, 6, 8, 445, 34567, 65434
A float is a decimal number.
Float - 1.0, 0.5, 2.33, 765.67, 1.33

Arithmetic operations can be executed on numbers, such as:

1. Addition: Sum of 2 numbers
2. Subtraction: Difference between 2 numbers
3. Multiplication: Product of 2 numbers
4. Division: Quotient of 2 numbers
5. Floor Division: Quotient of 2 numbers, except the fractional part
6. Exponentiation: A number raised to the power of another number Which is the same as:
7. Modulus: Reminder after division division of 2 numbers

Python follows BODMAS rule.
B-Bracket
O-Of
D-Division
M-Multiplication
A-Addition
S-Subtraction

Example:

DEV Community

Advice For Junior Developers

Advice from a career of 15+ years for new and beginner developers just getting started on their journey.