DEV Community

Cover image for Arithmetic Operations - Python - Part 1
Noor E Jannat Nafia
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 Image description
  2. Subtraction: Difference between 2 numbers Image description
  3. Multiplication: Product of 2 numbers Image description
  4. Division: Quotient of 2 numbers Image description
  5. Floor Division: Quotient of 2 numbers, except the fractional part Image description
  6. Exponentiation: A number raised to the power of another number Image description Which is the same as: Image description
  7. Modulus: Reminder after division division of 2 numbers Image description

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

Example:
Image description

Latest comments (0)