Check whether the given input is a complex type or not.

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
  1. Take a number as input.
  2. Using an if-else statement check whether the given input is a complex type or not.
  3. Print the output.
				
					num = 5+6j

if type(num) == complex:
    print("True")
else:
    print("False")
				
			

Output :

				
					True
				
			

Related Articles

check whether two numbers are equal or not.

check whether the given input is Boolean type or not.

Leave a Comment