Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

Operator /

Computes the true quotient of two numbers.

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

Syntax

left / right

Computes the true quotient of two numbers.

Use true division to compute a rate such as distance per unit time. Built-in integer and floating-point operands support fractional results; custom numeric classes may return another type.

Dividing by a zero-valued built-in numeric denominator raises an exception. For a quotient rounded down to an integer boundary use floor division instead.

Dividing two built-in integers produces a float even when the division is exact.

Syntax

left / right

__truediv__, __rtruediv__ · ZeroDivisionError

Worked example

7 / 2 → 3.5
8 / 4 → 2.0
2 / 0 → ZeroDivisionError

Examples

print(9 / 4)
print(type(8 / 4).__name__)

Result

2.25
float

Dividing two built-in integers produces a float even when the division is exact.

Sources