Find out given input belongs to which group

In this python nested if else program, we will find out given input belongs to which group.

Steps to solve the program
  1. Take a number between 1-100 as input through the user.
  2. Create 10 groups of numbers between 1-10. Each group will have 10 numbers (i.e. 1-10,11-20,….,91-100) using nested if-else statements.
  3. With the help of nested if-else statements check the input number lies in which group.
  4. Print the respective output.
				
					num = int(input("Enter a number: "))

if 1<= num <=10:
    print("The given number belongs to 1st group")
elif 11<= num <=20:
    print("The given number belongs to 2nd group")
elif 21<= num <=30:
    print("The given number belongs to 3rd group")
elif 31<= num <=40:
    print("The given number belongs to 4th group")
elif 41<= num <=50:
    print("The given number belongs to 5th group")
elif 51<= num <=60:
    print("The given number belongs to 6th group")
elif 61<= num <=70:
    print("The given number belongs to 7th group")
elif 71<= num <=80:
    print("The given number belongs to 8th group")
elif 81<= num <=90:
    print("The given number belongs to 9th group")
elif 91<= num <=100:
    print("The given number belongs to 10th group")
else:
print("Invalid number")
				
			

Output :

				
					Enter a number: 36
The given number belongs to 4th group
				
			

Related Articles

check the eligibility of a person to sit on a roller coaster ride or not.

find employees eligible for bonus.

Check the eligibility of a person to sit on a roller coaster ride

In this python if else program we will, check the eligibility of a person to sit on a roller coaster ride according to his/her age.

Codition for eligibility:
Age is greater than 12 then only person is eligible.

Steps to solve the program
  1. Take age as input through the user.
  2. Using an if-else statement check the eligibility of a person. 
  3. If the age is greater than or equal to 12 only then is the person eligible.
  4. Print the respective output.
				
					age = int(input("Enter the age of a person: "))

if age >= 12:
    print("You are eligible")
else:
    print("You are not eligible");
				
			

Output :

				
					Enter the age of a person: 15
You are eligible
				
			

Related Articles

check whether the given input is a dictionary or not.

find out given input belongs to which group

Check whether the given input is a dictionary.

In this python if else program, we will check whether the given input is a dictionary or not.

Dictionary:
A dictionary is a general-purpose data structure for storing a group of objects. A dictionary has a set of keys and each key has a single associated value.

Steps to solve the program
  1. Take input from the user.
  2. Using an if-else statement check whether the given input is a dictionary type or not.
  3. Print the output.
				
					iput = {'name':'Virat','sport':'cricket'}

if type(iput) == dict:
    print("True")
else:
    print("False")
				
			

Output :

				
					True
				
			

Related Articles

check whether the given input is List or not.

check the eligibility of a person to sit on a roller coaster ride or not.

Check whether the given input type is List or not

check whether the given input is Boolean type or not.

check whether the given input is a dictionary or not.

Check whether the given input is Boolean type.

In this python if else program, we will check whether the given input is Boolean type or not.

Boolean expression:
A Boolean expression is a logical statement that is either TRUE or FALSE . Boolean expressions can compare data of any type as long as both parts of the expression have the same basic data type.

Steps to solve the program
  1. Take input through the user.
  2. Using an if-else statement check whether the given input is a Boolean type or not.
  3. Print the output.
				
					num = True

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

Output :

				
					True
				
			

Related Articles

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

check whether the given input is List or not.

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.