varD = {key1: "value1", key2: "value2"} => Initialize a dictionaryvarD = {} => Initialize an empty dictionaryvarD[key] = "value" => Update or Add a new valuevarD.update(varD1) => Appends varD1 into the dictionarydel varD => Deletes entire dictionarydel varD[key] => Deletes key-value pairvarD.clear() => Clears all the elements from the dictionaryvarName = varD.pop(key) => Removes and Return the given key-value pairvarName = varD.popItem() => Removes and Return the last key-value pairvarD[key] => Returns values of that key if present else returns errorvarD.get(key) => Returns values of that key if present else returns "none"varD.keys() => Returns all the keysvarD.values() => Returns all the valuesvarT = varD.items() => Returns all the pairs as a sequence of (key,value) tuples in random order for key in varD.keys():
print(key) # Prints all the keys
print(varD[key]) # Prints all the values
for key, value in varD.items():
print(key) # Prints all the keys
print(value) # Prints all the values
len(varD) => Gives the count of pairsvarD2 = varD1.copy() => Creates a copy of varD1 into variable varD2