Operators

/= — True division assignment

Divide and update the target with the quotient. Built-in integer true division produces a float; an integer target is not constrained to remain an integer. A zero numeric divisor raises ZeroDivisionError. The __itruediv__() 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 numeric divisorValue used as the right operand of the operation.

Working Example

Example Snippetpython
budget = 15previous = budgetbudget /= 4print(budget)print(type(budget).__name__)print(previous)
Python Reference