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.

Leave a Comment