Float Attributes

float.imag

The imaginary component of a real number is always zero. This is a read-only attribute, accessed without parentheses. Its value has type float for the built-in float receiver. Assignment is not supported.

Formal Syntax & Structure

python syntaxpython
value.imag

Return Value

float

Value obtained by attribute access.

Working Example

Example Snippetpython
value = -2.5print(value.imag)print(type(value.imag).__name__)
Python Reference