Language Syntax

Imaginary literal — Python syntax

A numeric token ending in j or J denotes an imaginary component as a complex object with zero real part. A number with real and imaginary components is constructed by an expression such as 2+3j, not a single literal.

Formal Syntax & Structure

python syntaxpython
3j | 2.5J | 1e2j

Return Value

complex

Value obtained by evaluating this expression; see description for context and constraints.

Working Example

Example Snippetpython
z=2+3jprint((z.real,z.imag,type(3j).__name__))
Python Reference