In Python, the / and // operators are both used for division, but they behave differently. The / operator performs normal division and always returns a float, while the // operator performs floor division and returns an integer result, discarding any fractional part source.
Here’s a detailed tutorial explaining the differences between / and // operators in Python, with examples.
Python’s Division Operators
When it comes to division in Python, you have two choices: the / operator and the // operator. While they may look similar, they serve different purposes and return different results. In this tutorial, we’ll explore the distinctions between these operators and when to use each one.
Read How to Write a Variable to a File in Python?
The / Operator: Normal Division
The / operator in Python performs normal division, just like you learned in school. It divides the left operand by the right operand and returns a floating-point result, even if the division yields a whole number.
Here’s an example:
result = 10 / 3
print(result) Output:
3.3333333333333335I have executed the above example and added the screenshot below.

In this case, 10 is divided by 3, and the result is a float: 3.3333333333333335.
Even if the division results in a whole number, the / operator still returns a float:
result = 6 / 2
print(result)Output:
3.0Here, 6 divided by 2 equals 3, but the result is still a float: 3.0.
Check out Understand for i in range Loop in Python
The // Operator: Floor Division
The // operator, on the other hand, performs floor division. It divides the left operand by the right operand and rounds the result down to the nearest integer, discarding any fractional part.
Here’s an example:
result = 10 // 3
print(result) Output:
3I have executed the above example and added the screenshot below.

In this case, 10 is divided by 3, and the result is rounded down to 3. The fractional part is discarded.
If the division results in a whole number, the // operator returns that whole number as an integer:
result = 6 // 2
print(result) Output:
3Here, 6 divided by 2 equals 3, and the result is an integer.
Read How to Use Constructors in Python?
Handle Negative Numbers
When dealing with negative numbers, the behavior of the // operator might be surprising at first. It still rounds down, but it rounds towards negative infinity.
Here’s an example:
result = -10 // 3
print(result) # Output: -4In this case, -10 divided by 3 equals -3.3333..., but the // operator rounds it down to -4, not -3.
Check out Convert String to Uppercase in Python
Performance Considerations
In terms of performance, the // operator is slightly faster than the / operator because it doesn’t need to perform the extra step of creating a float object. However, the difference is usually negligible unless you’re performing millions of divisions in a performance-critical section of your code.
Read Data Science vs Machine Learning
Usage
So, when should you use the / operator, and when should you use the // operator? It depends on your specific needs:
- If you need the exact result of the division, including any fractional part, use the
/operator. - If you only need the whole number part of the division result, and you don’t care about the fractional part, use the
//operator.
Summary
| Operator | Description | Example | Result |
|---|---|---|---|
/ | Performs normal division and returns a float | 10 / 3 | 3.3333333333333335 |
6 / 2 | 3.0 | ||
// | Performs floor division and returns an integer | 10 // 3 | 3 |
6 // 2 | 3 | ||
| Rounds down towards negative infinity for negatives | -10 // 3 | -4 |
Check out Convert String to JSON in Python
Conclusion
In this tutorial, I have explained the difference between Python / and // operators. The / operator performs normal division and returns a float, while the // operator performs floor division. I showed differences with examples, and we saw how to handle negative numbers, performance considerations, where to use each operator, anda summary table.
You may also like to read:
- How to Check if a Variable Exists in Python?
- Convert Int to Bytes in Python
- How to Create a String of N Characters in Python?

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.