Do you know all of them?

Image for post

Photo by Jon Tyson on Unsplash

Numbers are everywhere in our daily life — there are phone numbers, dates of birth, ages, and other various identifiers (driver’s license and social security numbers, for example).

Naturally, all programming languages have a wide range of functionalities to process numbers. Most of these operations are based on common arithmetic operators — addition, subtraction, multiplication, and division — and everyone should be very familiar with them. However, various programming languages have unique operations that newcomers often find less intuitive.

In this article, I’d like to review five advanced operations for handling numbers in Python.


1. Less-Used Operators

As we all know, addition, subtraction, multiplication, and division are the most basic mathematical operators. However, there are three other operators that we use less but are quite handy.

  • The modulus operator, %, returns the remainder after the division of one number by the other number.
  • The exponentiation operator ** returns the result after raising a number to the power of another number.
  • The floor division operator // returns the largest possible result (e.g. rounding down 2.x to 2) after the division of one number by the other number.

#programming #software-development #technology #python #data-science

5 Advanced Operations to Handle Numbers in Python
1.45 GEEK