Print the values of the keys of a dictionary

In this program, we will print the values of the keys of a dictionary.

Steps to solve the program
  1. Take a Dictionary as input.
  2. Get the values of the keys of a dictionary using values().
  3. Use for loop to iterate over keys of the Dictionary.
  4. Print the output.
				
					dict1 = {'name':'virat','sports':'cricket'}

for value in dict1.values():
    print(value
				
			

Output :

				
					virat
cricket
				
			

print the keys of a dictionary

print the keys and values of a dictionary

Leave a Comment