to initialize stringin order to grow it in concatenation steps such as in for loopstart by setting the string variable to an empty string (which is just ''solution and discussionhere is the solution for the entire classwith the new method included import operator class bibliography(object)def __init__(selfentrieslist)self entrieslist entrieslist def sort_entries_alpha(self)tmp sorted(self entrieslistkey=operator attrgetter('authorlast''authorfirst')self entrieslist tmp del tmp def write_bibliog_alpha(self)self sort_entries_alpha(output 'for ientry in self entrieslistoutput output ientry write_bib_entry('\ \nreturn output[:- the only code that has changed compared to what we had previously is the write bibliog alpha methodlet' talk about what it does line defines the methodbecause self is the only argumentthe method is called with an empty argument list the next line calls the sort entries alpha method to make sure the list that is stored in the entrieslist attribute is alphabetized nextwe initialize the output string output as an empty string when the "+operator is usedpython will then use string concatenation on it lines - run for loop to go through all elements in the list entrieslist the output of write bib entry is added one entry at timealong with two linebreaks after it finallythe entire string is output except for the final two linebreaks (remember that strings can be manipulated using list slicing syntax