define histogram adt histogram is container that can be used to collect and store discrete frequency counts across multiple categories representing distribution of data the category objects must be comparable histogramcatseq )creates new histogram containing the categories provided in the given sequencecatseq the frequency counts of the categories are initialized to zero getcountcategory )returns the frequency count for the given categorywhich must be valid inccountcategory )increments the count by for the given category the supplied category must be valid totalcount()returns sum of the frequency counts for all of the categories iterator ()creates and returns an iterator for traversing over the histogram categories building histogram the program in listing produces text-based version of the histogram from figure and illustrates the use of the histogram adt the program extracts collection of numeric grades from text file and assigns letter grade to each value based on the common -point scalea the frequency counts of the letter grades are tabulated and then used to produce histogram listing the buildhist py program prints histogram for distribution of letter grades computed from collection of numeric grades extracted from text file from maphist import histogram def main()create histogram instance for computing the frequencies gradehist histogram"abcdfopen the text file containing the grades gradefile open('cs grades txt'" "extract the grades and increment the appropriate counter for line in gradefile grade int(linegradehist inccountlettergrade(grade(listing continued