In this python if else program, we will check whether the given input is a complex type or not.
Complex Number:
Complex numbers are the numbers that are expressed in the form of x+iy where, x,y are real numbers and ‘i’ is an imaginary number called “iota”. The value of i = (√-1).
Steps to solve the program
- Take a number as input.
- Using an if-else statement check whether the given input is a complex type or not.
- Print the output.
num = 5+6j
if type(num) == complex:
print("True")
else:
print("False")
Output :
True