Check whether a dictionary is empty or not.

In this python dictionary program, we will check whether a dictionary is empty or not.

Steps to solve the program
  1. Take a dictionary as input.
  2. Use an if-else statement with the len() function to check whether a dictionary is empty or not.
  3. Use logic to print the output.
				
					dict1 = {}
    
if len(dict1) > 0:
    print("Dictionary is not empty")
else:
    print("Dictionary is empty")
				
			

Output :

				
					Dictionary is empty
				
			

remove duplicate values from dictionary values.

add two dictionaries if the keys are the same then add their value.

Leave a Comment