Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

Operator /=

Divides the stored number by the right operand and replaces it with the true quotient.

Version: Python 3.14; repository image, production runtime not attested

Syntax

target /= value

Divides the stored number by the right operand and replaces it with the true quotient.

Use augmented division to normalize an accumulated numeric value by its sample count. Even an exact integer quotient becomes a floating-point result for built-in integer operands.

A zero-valued divisor raises a division exception before the ordinary variable receives a new value. User-defined numeric classes may implement their own in-place behavior.

With built-in integer operands the name is rebound to a float even when the quotient is exact.

Syntax

target /= value

__itruediv__, __truediv__, __rtruediv__ · ZeroDivisionError

Worked example

n = 6; n /= 3
n → 2.0
type(n) is float → True

Examples

value = 8
value /= 4
print(value)
print(type(value).__name__)

Result

2.0
float

With built-in integer operands the name is rebound to a float even when the quotient is exact.

Sources