Iterate Over Dictionaries in Python & Print Items in Key-value in Pair
(Last Updated On: 28/12/2022)
Python Program to Iterate Over Dictionaries and Print Items in Key-value in Pair
# Iterate Over Dictionaries in Python and Print Items in Key-value in Pairs
# Print items in Key-Value in pair
countryAndCode = {
'India': 'IND',
'Afghanistan': 'AFG',
'Canada': 'CAN',
'Russia': 'RUS'
}
keys = countryAndCode.items()
# we are printing the key values data in the form of pairs
# all the pairs are enclosed in a dictionary.
print(keys)