Operators
// — Floor division
For integers returns the quotient rounded toward negative infinity. Float operands yield a float representing a floored quotient, subject to floating-point limitations; complex operands are unsupported. Division by zero raises ZeroDivisionError. For integers, a == (a // b)*b + a%b when b is nonzero. Custom numeric types may define different behavior via __floordiv__ and __rfloordiv__; do not assume every third-party type uses integer floor semantics.
Formal Syntax & Structure
python syntaxpython
left // rightParameters & Attributes
| Name | Type | Description |
|---|---|---|
| left | real number or supporting object | Real numeric dividend or custom object. |
| right | real number or supporting object | Nonzero real numeric divisor or custom object. |
Return Value
number or custom result
Numeric result for supported built-in numbers; custom methods can return other objects.
Working Example
Example Snippetpython
print(7 // 3)print(-7 // 3)print(7 // -3)print(7.0 // 3)