Complex Number in Python

Level 120 keystrokes

This creates a complex number with real part 3 and imaginary part 4.

Python code

# complex(real, imag) creates a complex number from a real and an imaginary part
# Python writes the imaginary unit as j, so (3+4j) is printed
1print(complex(3, 4))

Output

(3+4j)
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Python code and how often they appear.

  • (× 2
  • )× 2
  • ,× 1

More Python examples at level 1

← Python typing practice