you will notice that if we tried to do this with an ordinary dictionarywe would get key error when we tried to add the first key the int we supplied as an argument to default dict is really the function int(that simply returns zero we canof coursecreate function that will determine the dictionary' values for examplethe following function returns true if the supplied argument is primary colorthat is redgreenor blueor returns false otherwisedef isprimary( )if ( ='red'or ( ='blue'or ( ='green')return true elsereturn false we can now create new defaultdict object and use the isprimary function to populate itnamed tuples the namedtuple method returns tuple-like object that has fields accessible with named indexes as well as the integer indexes of normal tuples this allows for code that isto certain extentself-documenting and more readable it can be especially useful in an application where there is large number of tuples and we need to easily keep track of what each tuple represents the namedtuple inherits methods from tuple and it is backward-compatible with tuple