the first line inside the function uses list comprehension to turn the characters list into list of tuples list comprehensions are an importantnon-object-oriented tool in pythonwe'll be covering them in detail in the next then we loop over each of the characters in the sentence we first look up the index of the character in the characters listwhich we know has the same index in our frequencies listsince we just created the second list from the first we then update that index in the frequencies list by creating new tuplediscarding the original one aside from the garbage collection and memory waste concernsthis is rather difficult to readlike dictionarieslists are objects tooand they have several methods that can be invoked upon them here are some common onesthe append(elementmethod adds an element to the end of the list the insert(indexelementmethod inserts an item at specific position the count(elementmethod tells us how many times an element appears in the list the index()method tells us the index of an item in the listraising an exception if it can' find it the find()method does the same thingbut returns - instead of raising an exception for missing items the reverse(method does exactly what it says--turns the list around the sort(method has some rather intricate object-oriented behaviorswhich we'll cover now sorting lists without any parameterssort will generally do the expected thing if it' list of stringsit will place them in alphabetical order this operation is case sensitiveso all capital letters will be sorted before lowercase lettersthat is comes before if it is list of numbersthey will be sorted in numerical order if list of tuples is providedthe list is sorted by the first element in each tuple if mixture containing unsortable items is suppliedthe sort will raise typeerror exception