To know about the most used methods of dictionary data type in python3.
This method is used to return the list with all dictionary keys without values.
This method is used to return the list with all dictionary values only.
It returns the count of key entities of the dictionary elements.
This function returns the data type of the argument.
This function creates the shallow copy of the dictionary into other dictionary.
#sample dictionary
dic={‘age’:[25,26,25,23,
30,29,23,24,26,25],
‘rating’:[4,3.6,2.5,2.25,4.5,4.4,
3.9,3.5,3.7,3.2],
‘bonus’:[1300,1400,1250,1100,
1500,1450,1150,1100,1250,1200],
‘salary’:[2500,2600,2400,2200,3000,
2900,2300,2200,2450,2350],}
#empty dictionary
dic1={}
print(“****Dictionary keys*****\n”)
print (dic.keys())
print(“\n”)
print(“****Dictionary values*****\n”)
print(dic.values())
print(“\n”)
print(“*****Length of dictionary*****\n”)
print(len(dic))
print(“\n”)
print(“*****Data type*****\n”)
print(type(dic))
print(“\n”)
print(“*****Copy dic to dic1***\n”)
#copying the keys and values to another dictionary
dic1=dic.copy()
print(dic1.items())