Operators

//= — Floor division assignment

Store the floor-division quotient. For built-in integers the result floors toward negative infinity, not toward zero. Float floor division returns a float. Complex numbers do not support this operation. The __ifloordiv__() hook may modify its receiver or supply a replacement. If absent or declining with NotImplemented, normal binary dispatch applies. The result is stored back into the target; this is a statement, not an expression. A failed store does not guarantee rollback.

Formal Syntax & Structure

python syntaxpython
target //= expression

Parameters & Attributes

NameTypeDescription
targetobjectExisting assignable name, attribute, item or slice; its current value participates in the operation.
rightcompatible nonzero real divisorValue used as the right operand of the operation.

Working Example

Example Snippetpython
remaining = -7remaining //= 3print(remaining)quantity = 7.0quantity //= 3print(quantity)
Python Reference