Division(/) vs Floor Division(//) Operators in Python

In Python, we have two division operators: / and //

The / is called normal Division operator and // is called Floor Division operator.

The Division (/) operator returns a fractional number whereas Floor Division(//) operator  rounds off the result to the nearest lower whole number.

Example:

x=13

y=2

print(x/y)

Output: 6.5

x=13

y=2

print(x//y)

Output: 6

x=-13

y=2

print(x/y)

Output: -6.5

x=-13

y=2

print(x//y)

Output: -7

2 thoughts on “Division(/) vs Floor Division(//) Operators in Python”

  1. Hey, I think your website might be having browser compatibility issues. When I look at your website in Chrome, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, amazing blog!

    Reply
  2. I do consider all the ideas you have introduced in your
    post. They’re very convincing and can certainly work.
    Nonetheless, the posts are too brief for beginners. Could you please lengthen them a
    bit from next time? Thank you for the post.

    Reply

Leave a comment