In this program, we will print the keys of a dictionary.
Steps to solve the program
- Take a Dictionary as input.
- Get the keys of the DIctionary using keys().
- Use for loop to iterate over keys of the Dictionary.
- Print the output.
dict1 = {'name':'virat','sports':'cricket'}
for keys in dict1.keys():
print(keys)
Output :
name
sports