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.

Program to check whether two numbers are equal or not.

In this python if else program, we will check whether two numbers are equal or not.

Steps to solve the program
  1. Take two numbers as input.
  2. Using an if-else statement check whether two numbers are equal or not.
  3. Print the output.
				
					num1 = 28
num2 = 88

if num1 == num2:
    print("The given numbers are equal")
else:
    print("The given numbers are not equal")
				
			

Output :

				
					The given numbers are not equal
				
			

Related Articles

check whether the input number is a cube of 3 or not.

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

Check whether the input number is a cube of 3

In this python if else program, we will check whether the input number is a cube of 3 or not.

Cube: To find the cube of a number, first, multiply that number by itself 3 times

Steps to solve the program
  1. Take a number as input.
  2. Using an if-else statement check whether the input number is a cube of 3 i.e. 27.
  3. Print the respective output.
				
					num = 27

if num == 27:
    print("True")
else:
    print("False")
				
			

Output :

				
					True
				
			

Related Articles

check whether the input number is a square of 6 or not.

check whether two numbers are equal or not.

Check whether the input number is a square of 6

In this python of else program, we will check whether the input number is a square of 6 or not.

Steps to solve the program
  1. Take a number as input.
  2. Using an if-else statement check whether the input number is a square of 6 i.e. 36.
  3. Print the respective output.
				
					num = 37

if num == 36:
    print("True")
else:
    print("False")
				
			

Output :

				
					True
				
			

Related Articles

check whether the input number is divisible by 12 or not.

check whether the input number is a cube of 3 or not.

Check whether the input number is divisible by 12.

In this python if else program, we will check whether the input number is divisible by 12 or not.

Steps to solve the program
  1. Take a number as input.
  2. Using an if-else statement check whether the input number is divisible by 12 or not.
  3. Print the respective output.
				
					num = 121

if num % 12 == 0:
    print("True")
else:
    print("False")
				
			

Output :

				
					False
				
			

Related Articles

check whether the input number is a float or not if yes then round up the number to 2 decimal places.

check whether the input number is a square of 6 or not.

Round up the number to 2 decimal places.

In this python if else program, we will round up the number to 2 decimal places if the number is a float.

Float number:
A float is a floating-point number, which means it is a number that has a decimal place. Floats are used when more precision is needed.

Steps to solve the program
  1. Take a number as input.
  2. Using an if-else statement check the type of the number using type().
  3. If the type of the number is a float then round up the number to 2 decimal places using the round() function.
  4. Else print the number as it.
				
					num = 25.3614

if type(num) == float:
    print(round(num,2))
else:
    print(num)
				
			

Output :

				
					25.36
				
			

Related Articles

reads month and returns season for that month.

check whether the input number is divisible by 12 or not.

Read month and returns season for that month.

In this python if else program, we will read month and returns season for that month.

Condition for the season:
Summer – February, March, April, May
Rainy – June, July, August, September
Winter – Octomber, November, December, January

Steps to solve the program
  1. Read the month from the user.
  2. Using an if-else statement print the season for the input month
				
					month = input("Enter a month: ")

if month == "February" or month == "March" or month == "April" or month == "May":
    print("Summer")
elif month == "June" or month == "July" or month == "August" or month == "September":
    print("Rainy")
else:
    print("Winter")
				
			

Output :

				
					Enter a month: February
Summer
				
			

Related Articles

check whether a triangle is isosceles or not.

check whether the input number is a float or not if yes then round up the number to 2

Check whether a triangle is isosceles or not.

In this python if else program, we will check whether a triangle is isosceles or not depending on the lengths of the sides.

An isosceles triangle is a triangle with (at least) two equal sides.

Steps to solve the program
  1. Take 3 sides of the triangle as input through the user.
  2. If any two sides of the triangle are equal then the triangle is an isosceles triangle.
  3. Use an if-else statement to check this.
  4. Print the output.
				
					s1 = int(input("Enter length of side 1: "))
s2 = int(input("Enter length of side 2: "))
s3 = int(input("Enter length of side 3: "))

if s1 == s2 or s2 == s3 or s1 == s3:
    print("It is an isosceles triangle")
else:
    print("It is not an isosceles triangle")
				
			

Output :

				
					Enter length of side 1: 10
Enter length of side 2: 15
Enter length of side 3: 10
It is an isosceles triangle
				
			

Related Articles

check whether a triangle is scalene or not.

reads month and returns season for that month.

Program to check whether a triangle is a scalene

In this python if else program, we will check whether a triangle is scalene or not depending on the side lengths.

A scalene triangle is a triangle in which all three sides are in different lengths, and all three angles are of different measures. However, the sum of all the interior angles is always equal to 180 degrees.

Steps to solve the program
  1. Take 3 sides of the triangle as input through the user.
  2. If all three sides of the triangle are not equal then the triangle is a scalene triangle.
  3. Use an if-else statement to check this.
  4. Print the output.
				
					s1 = int(input("Enter length of side 1: "))
s2 = int(input("Enter length of side 2: "))
s3 = int(input("Enter length of side 3: "))

if s1 != s2 != s3:
    print("It is a scalane triangle")
else:
    print("It is not a scalane triangle")
				
			

Output :

				
					Enter length of side 1: 10
Enter length of side 2: 15
Enter length of side 3: 18
It is an scalane triangle
				
			

Related Articles

check whether a triangle is equilateral or not.

check whether a triangle is isosceles or not.

Check whether a triangle is equilateral or not

In this pytho if else program, we will program to check whether a triangle is equilateral or not. An equilateral triangle is a triangle with all three sides of equal length

Steps to solve the program
  1. Take 3 sides of the triangle as input through the user.
  2. If all three sides of the triangle are equal then the triangle is an equilateral triangle.
  3. Use an if-else statement to check this.
  4. Print the output.
				
					s1 = int(input("Enter length of side 1: "))
s2 = int(input("Enter length of side 2: "))
s3 = int(input("Enter length of side 3: "))

if s1 == s2 == s3:
    print("It is an equilateral triangle")
else:
    print("It is not an equilateral triangle")
				
			

Output :

				
					Enter length of side 1: 15
Enter length of side 2: 15
Enter length of side 3: 15
It is an equilateral triangle
				
			

Related Articles

convert the month name to the number of days.

check whether a triangle is scalene or not.