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
- Take input from the user.
- Using an if-else statement check whether the given input is a dictionary type or not.
- Print the output.
iput = {'name':'Virat','sport':'cricket'}
if type(iput) == dict:
print("True")
else:
print("False")
Output :
True