# Creating complex numbers
num1 = 2 + 3j
num2 = -4j
num3 = complex(5, -2)
# Outputting the complex numbers
print(num1)
print(num2)
print(num3)
(2+3j)
(-0-4j)
(5-2j)
j
` notation to indicate the imaginary part of the number. The first number, `num1
`, is equal to `2 + 3j
`, the second number, `num2
`, is equal to `-4j
`, and the third number, `num3
`, is equal to `5 - 2j
`. Alternatively, we can also create a complex number using the `complex()
` constructor function, as shown with `num3
`.print
` function to output the values of the complex numbers to the console.real
` and `imag
` attributes, respectively. For example:num = 2 + 3j
print(num.real) # 2.0
print(num.imag) # 3.0